Closed Bug 39356 Opened 25 years ago Closed 25 years ago

ViewManager2 leaks a DrawingSurface

Categories

(Core Graveyard :: Embedding: GTK Widget, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: yueheng.xu, Assigned: pavlov)

Details

Attachments

(1 file)

I run the refcnt balancer and found out that the leaked class nsDrawingSurfaceGTK as reported in the bloatview is actually is: The nsViewManager2:Refresh() defined a local variable ds nsDrawingSurface ns = null; ( line 454 in http://lxr.mozilla.org/mozilla/source/view/src/nsViewManager2.cpp ) this ds created a new object at line 514: ds = GetDrawingSurface(...) and used in line 529 and line 530. But it never release the object. Fix: add NS_IF_RELEASE(ds) in nsViewManager2:refresh() when ds is no longer needed.
yueheng, small little typo: nsDrawingSurface ds = null; instead of: nsDrawingSurface ns = null; More importantly, it doesn't appear from the code as if nsDrawingSurface is an XPCOM object, I'm not sure your suggestion fixes anything (or is even valid to release this object). From glancing at the code, seems like ds is obtained from GetDrawingSurface, which in turn returns a member variable (mDrawingSurface), which in turn gets destroyed in the destructor.
For each CreateDrawingSurface there needs to be a DestroyDrawingSurface. As far as I can tell, everytime a new drawing surface is created in nsViewManager2.cpp (for mDrawingSurface, gOffScreen, gRed, or gBlue) a check is made to destroy any preexisting surface. And then, in the nsViewManager2's destructor, each of the four possible surfaces is checked and DestroyDrawingSurface is called on each if needed. I don't see a leak here, and calling NS_IF_RELEASE(ds) will probobly cause a crash.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
It seems that above comments are convincing. Here I attach the ref count balance tree for future reference if we want to go back to this.
Attached file Refcnt Balance tree
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: