Inconsistent casting of nsIObserver to nsISupports may lead to object leaks

RESOLVED FIXED

Status

Core Graveyard
Embedding: GRE Core
RESOLVED FIXED
12 years ago
2 years ago

People

(Reporter: Mikhail Zabaluev, Assigned: Mikhail Zabaluev)

Tracking

({memory-leak})

Trunk
memory-leak

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Xulrunner trunk

In nsCommandManager, there is an inconsistency between AddCommandObserver and RemoveCommandObserver in how the object passed as nsIObserver is casted to nsISupports to do operations on the observer array. In the former, it's a QI, but the latter uses an implicit static cast. This, depending on the observer's interface map, may lead to spurious failures of RemoveCommandObserver and object leaks.

Reproducible: Always
(Assignee)

Comment 1

12 years ago
Created attachment 228146 [details] [diff] [review]
Change RemoveCommandObserver to QueryInterface a nsISupports from nsIObserver
Assignee: nobody → mhz
Status: UNCONFIRMED → NEW
Ever confirmed: true
Fix checked in.  Thanks for the patch!
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED

Updated

11 years ago
Keywords: mlk
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.