Closed
Bug 742384
Opened 12 years ago
Closed 12 years ago
In CDataFinalizer, .dispose() should return something useful
Categories
(Core :: js-ctypes, defect)
Tracking
()
RESOLVED
FIXED
mozilla15
People
(Reporter: Yoric, Assigned: Yoric)
References
Details
(Keywords: dev-doc-needed)
Attachments
(1 file, 8 obsolete files)
19.92 KB,
patch
|
Details | Diff | Splinter Review |
At the moment, .dispose() returns undefined. It should return the result of the call to the finalizer.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
Here is a new version. It simplifies the code a little and adds tests.
Assignee: nobody → dteller
Attachment #612220 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #613564 -
Flags: review?(jorendorff)
Comment 3•12 years ago
|
||
Comment on attachment 613564 [details] [diff] [review] Returning the value after dispose Looks good, r=me. >+ jsval result = JSVAL_VOID; >+ >+ >+ int errnoStatus; Style nit: please remove one of the two blank lines here. >+ if (ConvertToJS(cx, resultType, NULL, p->rvalue, false, true, &result)) { >+ CDataFinalizer::Cleanup(p, obj); >+ JS_SET_RVAL(cx, vp, result); >+ return true; >+ } > CDataFinalizer::Cleanup(p, obj); It seems best to call Cleanup first: CDataFinalizer::Cleanup(p, obj); if (!ConvertToJS(cx, resultType, NULL, p->rvalue, false, true, &result)) { return false; } JS_SET_RVAL(cx, vp, result); return true; This is just defensive programming: after the finalizer is called, obj is supposed to be empty. See, only two little comments! SpiderMonkey style can be learned! :)
Attachment #613564 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Jason Orendorff [:jorendorff] from comment #3) > Comment on attachment 613564 [details] [diff] [review] > Returning the value after dispose > > Looks good, r=me. > > >+ jsval result = JSVAL_VOID; > >+ > >+ > >+ int errnoStatus; > > Style nit: please remove one of the two blank lines here. > > >+ if (ConvertToJS(cx, resultType, NULL, p->rvalue, false, true, &result)) { > >+ CDataFinalizer::Cleanup(p, obj); > >+ JS_SET_RVAL(cx, vp, result); > >+ return true; > >+ } > > CDataFinalizer::Cleanup(p, obj); > > It seems best to call Cleanup first: > > CDataFinalizer::Cleanup(p, obj); > if (!ConvertToJS(cx, resultType, NULL, p->rvalue, false, true, &result)) > { > return false; > } > JS_SET_RVAL(cx, vp, result); > return true; > > This is just defensive programming: after the finalizer is called, obj is > supposed to be empty. Actually, |Cleanup| cleans |p| and |p->rvalue|, which I need in the call to |ConvertToJS|. So, I suppose I could do that, but I would first need to copy |p->rvalue| and then clean that copy. Do you think it is useful? > See, only two little comments! SpiderMonkey style can be learned! :) I hope I will not have forgotten that style next time I context-switch from XPCOM-land :)
Comment 5•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #4) > Actually, |Cleanup| cleans |p| and |p->rvalue|, which I need in the call to > |ConvertToJS|. So, I suppose I could do that, but I would first need to copy > |p->rvalue| and then clean that copy. Do you think it is useful? Ah, no, don't bother.
Assignee | ||
Comment 6•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Attachment #613564 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed,
dev-doc-needed
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #613786 -
Attachment is obsolete: true
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #613908 -
Attachment is obsolete: true
Assignee | ||
Comment 10•12 years ago
|
||
Fixed testsuite build issue on Linux 64.
Attachment #613909 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 11•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/10b783e85c1e The CTypes.cpp changes in the updated patch were already present in the file, FWIW.
Keywords: checkin-needed
Comment 12•12 years ago
|
||
Backed out whole merge for bustage per Yoric (Bug 743574): https://hg.mozilla.org/integration/mozilla-inbound/rev/12e42fb8e321
Target Milestone: mozilla14 → ---
Updated•12 years ago
|
Keywords: checkin-needed
Comment 13•12 years ago
|
||
Disregard that; PEBKAC. Did not get backed out. I misread TBPL.
Keywords: checkin-needed
Target Milestone: --- → mozilla14
Assignee | ||
Comment 14•12 years ago
|
||
Attachment #613962 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #614301 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #613962 -
Attachment is obsolete: false
Comment 15•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ce72679ffb95
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 17•12 years ago
|
||
Sorry, I backed out these changes because they depend on bug 720771 which was backed out because of crashes (bug 745233): https://hg.mozilla.org/mozilla-central/rev/e1f0bb28fbb4
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla14 → ---
Assignee | ||
Comment 18•12 years ago
|
||
I _think_ that I have managed to fix the mysterious mysterious almost-always-reproducible Linux 64bit PGO test crash (bug 745233). I will keep attempting to find out what causes it, though.
Attachment #613962 -
Attachment is obsolete: true
Assignee | ||
Comment 19•12 years ago
|
||
Applied same changes as in parent bug.
Attachment #614922 -
Attachment is obsolete: true
Attachment #615714 -
Flags: review?(jorendorff)
Assignee | ||
Comment 20•12 years ago
|
||
As jorendorff has marked the parent bug r+ and as I have made the exact same changes here, I will just proceed.
Keywords: checkin-needed
Assignee | ||
Comment 21•12 years ago
|
||
Comment on attachment 615714 [details] [diff] [review] Returning the result of dispose [Approval Request Comment] Please see https://wiki.mozilla.org/Tree_Rules for information on mozilla-central landings that do not require approval. Possible risk to Fennec Native 14 (if any): Patches js-ctypes to add new features. It should not alter the behavior of any existing feature, though.
Attachment #615714 -
Flags: review?(jorendorff) → approval-mozilla-central?
Comment 22•12 years ago
|
||
Comment on attachment 615714 [details] [diff] [review] Returning the result of dispose [Triage Comment] Merge of 14 to Aurora has completed. Please renominate for mozilla-aurora.
Attachment #615714 -
Flags: approval-mozilla-central?
Comment 23•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/131687a69268
Keywords: checkin-needed
Target Milestone: --- → mozilla15
Comment 24•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/131687a69268
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•