Closed
Bug 1233060
Opened 9 years ago
Closed 7 years ago
No unprotected references in Bluetooth backend code
Categories
(Firefox OS Graveyard :: Bluetooth, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: tzimmermann, Assigned: tzimmermann)
References
Details
Attachments
(1 file)
8.00 KB,
patch
|
Details | Diff | Splinter Review |
We have unprotected references to result handlers in the Bluetooth backend code. This leads to ref-counting problems like bug 1232670. The correct fix is to always keep classes protected by smart pointers.
Assignee | ||
Comment 1•9 years ago
|
||
Nathan, I want to construct objects with |MakeAndAddRef| and pass the raw pointer to a function. But the |already_AddRefed| that is returned by |MakeAndAddRef| cannot be converted to a raw pointer. So I added a new helper named |MakeRef| that returns a |RefPtr|. I'd rather prefer to change the return type of |MakeAndAddRef| to |RefPtr| and fix the rest of tree where necessary. I'd like to ask for your opinion on this. Are there better options?
Attachment #8698994 -
Flags: feedback?(nfroyd)
Comment 2•9 years ago
|
||
Comment on attachment 8698994 [details] [diff] [review] 01_convert_bluedroid_service.patch Review of attachment 8698994 [details] [diff] [review]: ----------------------------------------------------------------- I don't think this patch is going in the right direction because we have things like: http://mxr.mozilla.org/mozilla-central/source/mfbt/RefPtr.h#259 which will make all of the examples herein compile-time errors with new-enough compilers (if they're not already; I don't know what GCC version we're using across our B2G compilers). I don't think converting MakeAndAddRef to MakeRef is a good idea because then things like: NS_DispatchToCurrentThread(MakeAndAddRef<T>(...)); and associated event dispatching variants won't work correctly. And: NS_DispatchToCurrentThread(MakeRef<T>(...).forget()); is unwieldy. You could make NS_DispatchToCurrentThread take RefPtr, but that doesn't communicate the transfer of ownership that the current signature does.
Attachment #8698994 -
Flags: feedback?(nfroyd)
Assignee | ||
Updated•7 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•