Closed Bug 473946 Opened 14 years ago Closed 14 years ago

QMozWidget objects are leaked

Categories

(Core Graveyard :: Widget: Qt, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tobias.hunger, Assigned: tobias.hunger)

Details

Attachments

(1 file)

When visiting a website one or more new MozQWidget are created. The old ones should get deleted (deleteLater() is called on them). This fails due to
MozQWidget ignoring the event requesting it to delete itself.

So mozilla is currently leaking one or more QWidgets per web page visiting.

The attached patch fixes this by propagating the event triggered by calling deleteLater() to the proper place.
Attachment #357350 - Flags: review?(mark.finkle)
Attachment #357350 - Flags: review?(mark.finkle) → review+
Please, attach a Hg diff.
Assignee: nobody → tobias.hunger
Status: NEW → ASSIGNED
Keywords: checkin-needed
Whiteboard: [needs landing]
Pushed http://hg.mozilla.org/mozilla-central/rev/843255371ae7 after hand-applying the patch...
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing]
Qt 4.5
steps: multiple open/close tabs
outcome: crash

backout of the patch attached helps a lot.

------------------------------
(gdb) bt
#0  0xb7f617f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0xb6bb9386 in nanosleep () from /lib/i686/cmov/libc.so.6
#2  0xb6bb919e in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:138
#3  0xb7f25202 in ah_crap_handler (signum=11) at /mnt/sdb/mozilla-central-qt/toolkit/xre/nsSigHandlers.cpp:149
#4  0xb7f26278 in nsProfileLock::FatalSignalHandler (signo=11) at nsProfileLock.cpp:216
#5  <signal handler called>
#6  QCoreApplication::postEvent (receiver=0xb6482fc0, event=0xad02e280, priority=0) at kernel/qcoreapplication.cpp:1004
#7  0xb6fa788c in QCoreApplication::postEvent (receiver=0xb6482fc0, event=0xad02e280) at kernel/qcoreapplication.cpp:965
#8  0xb6fb6f87 in QObject::deleteLater (this=0xb6482fc0) at kernel/qobject.cpp:2017
#9  0xb5db5903 in nsWindow::Destroy (this=0xb6417870) at /mnt/sdb/mozilla-central-qt/widget/src/qt/nsWindow.cpp:321
#10 0xb2d4c1ef in ~nsView (this=0xb647a8e0) at /mnt/sdb/mozilla-central-qt/view/src/nsView.cpp:271
#11 0xb2d49f3c in nsIView::Destroy (this=0xb647a8e0) at /mnt/sdb/mozilla-central-qt/view/src/nsView.cpp:313
#12 0xb2d55517 in ~nsViewManager (this=0xb647a9a0) at /mnt/sdb/mozilla-central-qt/view/src/nsViewManager.cpp:192
#13 0xb2d53cf2 in nsViewManager::Release (this=0xb647a9a0) at /mnt/sdb/mozilla-central-qt/view/src/nsViewManager.cpp:238
#14 0xb27bc13e in ~nsCOMPtr (this=0xad5e408c) at ../../../dist/include/xpcom/nsCOMPtr.h:510
#15 0xb27e93d2 in ~DocumentViewerImpl (this=0xad5e4060)
    at /mnt/sdb/mozilla-central-qt/layout/base/nsDocumentViewer.cpp:585
#16 0xb27e5092 in DocumentViewerImpl::Release (this=0xad5e4060)
    at /mnt/sdb/mozilla-central-qt/layout/base/nsDocumentViewer.cpp:552
#17 0xb5f5c0ee in XPCJSRuntime::GCCallback (cx=0xb4005400, status=JSGC_END)
    at /mnt/sdb/mozilla-central-qt/js/src/xpconnect/src/xpcjsruntime.cpp:781
#18 0xb2d604e7 in DOMGCCallback (cx=0xb4005400, status=JSGC_END)
    at /mnt/sdb/mozilla-central-qt/dom/base/nsJSEnvironment.cpp:3606
#19 0xb5f2b26e in XPCCycleCollectGCCallback (cx=0xb4005400, status=JSGC_END)
    at /mnt/sdb/mozilla-central-qt/js/src/xpconnect/src/nsXPConnect.cpp:411
#20 0xb7da188c in js_GC (cx=0xb4005400, gckind=GC_NORMAL) at /mnt/sdb/mozilla-central-qt/js/src/jsgc.cpp:3874
#21 0xb7d4ff58 in JS_GC (cx=0xb4005400) at /mnt/sdb/mozilla-central-qt/js/src/jsapi.cpp:2505
#22 0xb5f2a5fa in nsXPConnect::Collect (this=0xb6371860)
    at /mnt/sdb/mozilla-central-qt/js/src/xpconnect/src/nsXPConnect.cpp:477
#23 0xb7cea46b in nsCycleCollector::Collect (this=0xb63c5000, aTryCollections=1)
    at /mnt/sdb/mozilla-central-qt/xpcom/base/nsCycleCollector.cpp:2256
#24 0xb7cea54c in nsCycleCollector_collect () at /mnt/sdb/mozilla-central-qt/xpcom/base/nsCycleCollector.cpp:2904
#25 0xb2d613c7 in nsJSContext::CC () at /mnt/sdb/mozilla-central-qt/dom/base/nsJSEnvironment.cpp:3426
#26 0xb2d6153a in nsJSContext::MaybeCC (aHigherProbability=1)
    at /mnt/sdb/mozilla-central-qt/dom/base/nsJSEnvironment.cpp:3494
#27 0xb2d6157e in nsJSContext::CCIfUserInactive () at /mnt/sdb/mozilla-central-qt/dom/base/nsJSEnvironment.cpp:3511
#28 0xb2d61797 in GCTimerFired (aTimer=0xad06d580, aClosure=0x0)
    at /mnt/sdb/mozilla-central-qt/dom/base/nsJSEnvironment.cpp:3534
#29 0xb7cd7dfa in nsTimerImpl::Fire (this=0xad06d580) at /mnt/sdb/mozilla-central-qt/xpcom/threads/nsTimerImpl.cpp:428
#30 0xb7cd802b in nsTimerEvent::Run (this=0xad01d440) at /mnt/sdb/mozilla-central-qt/xpcom/threads/nsTimerImpl.cpp:520
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) frame 9
#9  0xb5db5903 in nsWindow::Destroy (this=0xb6417870) at /mnt/sdb/mozilla-central-qt/widget/src/qt/nsWindow.cpp:321
321	        mMozQWidget->deleteLater();
(gdb) list
316	        mMozQWidget->dropReceiver();
317	
318	        // Call deleteLater instead of delete; Qt still needs the object
319	        // to be valid even after sending it a Close event.  We could
320	        // also set WA_DeleteOnClose, but this gives us more control.
321	        mMozQWidget->deleteLater();
322	    }
323	
324	
325	    OnDestroy();
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I think this is not directly related to the patch and am investigating further.
This tab crashing issue is unrelated to this bug report.

See #485579 for a patch.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.