Closed Bug 799243 Opened 14 years ago Closed 14 years ago

[b2g-bluetooth] Fix Bluetooth*Manager observer crashes due to non-RefCounted pointer

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: qdot, Assigned: qdot)

Details

Attachments

(2 files)

Having once again violated the "don't pass a damn nsAutoPtr to the observer manager" rule, shutting down bluetooth profile manager observers crashes due to having an AutoPtr that doesn't clean up correctly when removed from the observer manager (since observer manager holds strong refs). Introduced in bug 798035.
Summary: [b2g-bluetooth] Fix Bluetooth*Manager observer crashes due to wrong pointer type holding → [b2g-bluetooth] Fix Bluetooth*Manager observer crashes due to non-RefCounted pointer
Comment on attachment 669287 [details] [diff] [review] Patch 1 (v1) - Fix Bluetooth*Manager observer pointers to be nsRefPtr Review of attachment 669287 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth/BluetoothHfpManager.cpp @@ +62,5 @@ > + > + bool Shutdown() > + { > + nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); > + if (obs && Nit: Because obs may be null here, how about using a MOZ_ASSERT just like what has been done in Init(), or modify the if-statement to "if (!obs || NSFAILED() || NSFAILED())"? ::: dom/bluetooth/BluetoothScoManager.cpp @@ +51,4 @@ > { > nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); > if (obs && > (NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID)))) { Nit: Because obs may be null here, how about using a MOZ_ASSERT just like what has been done in Init(), or modify the if-statement to "if (!obs || NSFAILED())"?
Attachment #669287 - Flags: review?(echou) → review+
Attachment #669289 - Flags: review?(echou) → review+
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: mozilla18 → mozilla19
blocking-basecamp: ? → +
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: