Closed
Bug 278113
Opened 20 years ago
Closed 20 years ago
Handling 'out' params incorrectly
Categories
(Core Graveyard :: Java to XPCOM Bridge, defect)
Core Graveyard
Java to XPCOM Bridge
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jhpedemonte, Assigned: jhpedemonte)
Details
Attachments
(2 files)
86.53 KB,
patch
|
Details | Diff | Splinter Review | |
76.70 KB,
patch
|
darin.moz
:
review+
|
Details | Diff | Splinter Review |
Created a testcase that calls a function with an 'out' param which crashes in nsJavaWrapper. The problem is that in SetupParams, I use aVariant.ptr, but in FinalizeParams, I reference aVariant.val.p. Need to be consistent.
Assignee | ||
Comment 1•20 years ago
|
||
Turns out there were many problems with parameter handling, in addition to the inconsistency mentioned above: - Shouldn't hold Java array and string contents across invocations. For example, calling GetIntArrayElements() in SetupParams(), then invoking the function, and finally calling ReleaseIntArrayElements() in FinalizeParams() is wrong. This pins the memory of that array in the JVM and doesn't allow it to me moved or garbage collected, if necessary. This patch uses more efficient functions and does not hold any JVM memory across function invocations. - Currently doesn't take into account that the caller can pass in null for 'inout', 'out', and 'retval' params. This fixes that. - Patch also makes similar changes in nsJavaXPTCStub. - Always need to call ReleaseStringChars/ReleaseArrayElements, no matter if isCopy is TRUE or FALSE.
Assignee | ||
Comment 2•20 years ago
|
||
Attachment #171049 -
Flags: review?(darin)
Comment 3•20 years ago
|
||
Comment on attachment 171049 [details] [diff] [review] patch (diff -w) r=darin
Attachment #171049 -
Flags: review?(darin) → review+
Assignee | ||
Comment 4•20 years ago
|
||
Checked in to trunk. -> FIXED
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•