After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158217 - leaks a MozDownload
leaks a MozDownload
Status: RESOLVED NOTGNOME
Product: epiphany
Classification: Core
Component: [obsolete] Backend:Mozilla
git master
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Marco Pesenti Gritti
Depends on:
Blocks:
 
 
Reported: 2004-11-13 22:22 UTC by Christian Persch
Modified: 2005-01-01 20:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdb log (13.94 KB, patch)
2004-12-25 20:26 UTC, Christian Persch
none Details | Review

Description Christian Persch 2004-11-13 22:22:14 UTC
Steps to reproduce:
0) run ephy with EPHY_LOG_MODULES=ContentHandler.cpp:MozDownload.cpp
1) Click on this link:
http://ftp.acc.umu.se/pub/GNOME/sources/epiphany-extensions/1.5/epiphany-extensions-1.5.1.tar.bz2
2) Choose "Download"

Expected results:
No leaks.

Actual results:
[ ContentHandler.cpp ] GContentHandler ctor (0x8b6e8d8)
[ MozDownload.cpp ] MozDownload ctor (0x8736be0)
[ ContentHandler.cpp ] GContentHandler dtor (0x8b6e8d8)

As you can see, the MozDownload is not finalised.

Not sure if this is mozilla or us... this is with ephy HEAD using moz trunk from
2004-11-13, and it doesn't happen with ephy gnome-2-8 using moz 1.7.3.
Comment 1 Christian Persch 2004-12-25 20:22:14 UTC
Ok, here's what's happening:

http://lxr.mozilla.org/seamonkey/source/uriloader/exthandler/nsExternalHelperAppService.cpp

nsExternallAppHandler is created

in ::OnStartRequest, it creates the GContentHandler since that's our registered
nsIHelperAppLauncherDialog
and calls GContentHandler::Show()

which shows our dialogue

now it gets a stop request! nsExternalAppHandler::OnStopRequest

I choose "Save As" in our content handler, which calls
nsExternalAppHandler::SaveToDisk

which calls ::CreateProgressListener
which creates the nsIDownload (i.e. MozDownload)
calls ::InitializeDownload, which sets itself as its observer
(MozDownload::SetObserver)
then calls ::SetWebProgressListener

which calls ::ExecuteDesiredAction, since we've already seen a stop request
(mStopRequestIssued)
which will call MozDownload::OnStateChange with STATE_STOP

back in ::SetWebProgressListener, it calls MozDownload::OnStateChange with
STATE_START !

now we have:
nsExternalAppHandler owns MozDownload
MozDownload owns nsExternalAppHandler as its Observer

normally, nsExternalAppHandler::OnStopRequest does SetObserver(nsnull), but
since it does not yet even HAVE a progress listener, does not.
Comment 2 Christian Persch 2004-12-25 20:26:14 UTC
Created attachment 35200 [details] [review]
gdb log
Comment 3 Christian Persch 2005-01-01 20:09:48 UTC
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=276112