Closed
Bug 1375217
Opened 8 years ago
Closed 8 years ago
Avoid raw pointers in mozStorageAsyncStatementExecution.cpp
Categories
(Core :: SQLite and Embedded Database Bindings, enhancement, P1)
Tracking
()
RESOLVED
FIXED
mozilla56
People
(Reporter: mak, Assigned: mak)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fxsearch])
Attachments
(2 files)
|
59 bytes,
text/x-review-board-request
|
asuth
:
review+
|
Details |
|
12.59 KB,
patch
|
RyanVM
:
approval-mozilla-esr52+
|
Details | Diff | Splinter Review |
We can likely use NewRunnableMethod here instead of creating our own runnable classes.
| Comment hidden (mozreview-request) |
| Assignee | ||
Comment 2•8 years ago
|
||
Comment 3•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8880290 [details]
Bug 1375217 - Avoid raw pointers in mozStorageAsyncStatementExecution.cpp.
https://reviewboard.mozilla.org/r/151652/#review156948
This is a nice cleanup!
::: storage/mozStorageAsyncStatementExecution.h:86
(Diff revision 1)
> + * Used by notifyComplete(), notifyError() and notifyResults() to notify on
> + * the calling thread.
> + */
nit: indentation
::: storage/mozStorageAsyncStatementExecution.cpp:365
(Diff revision 1)
> + // Hold a strong reference to the callback while notifying it, so that if
> + // it spins the event loop, the callback won't be released and freed out
> + // from under us.
> + // Additionally, take ownership of it, so it gets released on this thread.
I suggest increasing the specificity of this comment and its clones. Specifically, 2 variants:
Callback-using-but-not-freeing (notifyResults):
Acquire our own strong reference so that if the callback spins a nested event loop and notifyCompleteOnCallingThread/notifyErrorOnCallingThread are executed, forgetting mCallback, we still have a valid/strong reference that won't be freed until we exit.
Ownership-taking/freeing:
Take ownership of mCallback and responsibility for freeing it when we release it. Any notifyResultsOnCallingThread calls on the stack spinning the event loop have guaranteed their safety by creating their own strong reference before invoking the callback.
Attachment #8880290 -
Flags: review?(bugmail) → review+
| Assignee | ||
Comment 4•8 years ago
|
||
yeah, I just noticed my comments were bogus. I fixed the code but not the comments.
notifyError uses the callback, but doesn't take ownership nor free it, the only one taking responsibility to free the callback is rightly the complete callback. indeed we notify completion after errors/results.
I'll update all comments accordingly.
| Assignee | ||
Comment 5•8 years ago
|
||
sigh, notifyError takes ownership but not responsibility to free the callback. btw, updated patch incoming.
| Comment hidden (mozreview-request) |
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/58eabe7c225b
Avoid raw pointers in mozStorageAsyncStatementExecution.cpp. r=asuth
Comment 8•8 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
| Assignee | ||
Comment 9•8 years ago
|
||
[Approval Request Comment]
If this is not a sec:{high,crit} bug, please state case for ESR consideration: It fixes Bug 1348955 that is a sec-high.
User impact if declined: Bug 1348955
Fix Landed on Version: 55
Risk to taking this patch (and alternatives if risky): not particularly risky
String or UUID changes made by this patch: none
See https://wiki.mozilla.org/Release_Management/ESR_Landing_Process for more info.
Attachment #8948026 -
Flags: approval-mozilla-esr52?
| Assignee | ||
Comment 10•8 years ago
|
||
Note, the patch also includes bug 1350752.
Comment 11•8 years ago
|
||
Comment on attachment 8948026 [details] [diff] [review]
patch for ESR52
Approved for ESR 52.7, thanks for the rebased patch.
Attachment #8948026 -
Flags: approval-mozilla-esr52? → approval-mozilla-esr52+
Comment 12•8 years ago
|
||
| bugherder uplift | ||
status-firefox-esr52:
--- → fixed
Updated•1 year ago
|
Product: Toolkit → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•