GNOME Bugzilla – Bug 158217
leaks a MozDownload
Last modified: 2005-01-01 20:09:48 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.
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.
Created attachment 35200 [details] [review] gdb log
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=276112