Bug 181784

Summary: Leaks three X windows when context menu is opened
Product: [Applications] konqueror Reporter: olig9
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal    
Priority: NOR    
Version: 3.5   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description olig9 2009-01-24 19:04:46 UTC
Version:           3.5.9 (using KDE 3.5.10)
OS:                Linux
Installed from:    Debian testing/unstable Packages

When right-clicking in a Konqueror window (no matter whether filemanagement or web browser), Konqueror apparently creates 8 X windows (with XCreateSimpleWindow, as children of the root window) but only destroys 5 of them when the menu is closed. It looks like the remaining 3 windows keep existing until this Konqueror instance is closed. The windows belong to the Open With, Preview and Actions submenus.

The leak can be seen by running `xwininfo -root -children | wc -l` before and after right-clicking in a Konqueror window - the number of windows reliably increases.

Unfortunately I could not see the leak in Valgrind, because the QWidget destructor (for QMainWindow) destroys all its children when the Konqueror instance is closed, so for Valgrind everything looks fine in the end :-(

I did not verify in detail if the leaked windows are really never closed; but `xwininfo -root -children | grep "840x420+420+315" | wc -l` currently shows that 6748 windows with these curious coordinates and size are existing on my system, and the attributes exactly match those of the leaked windows.

Here are two patches which together fix the problem for me:

--- kdebase-orig/kdebase-3.5.9.dfsg.1/konqueror/konq_mainwindow.cc	2007-10-08 11:51:30.000000000 +0200
+++ kdebase/kdebase-3.5.9.dfsg.1/konqueror/konq_mainwindow.cc	2009-01-24 01:05:25.000000000 +0100
@@ -4740,6 +4740,9 @@
   QGuardedPtr<QObject> guard(this); // #149736
   pPopupMenu->exec( _global );
 
+  pPopupMenu->factory()->removeClient( konqyMenuClient );
   delete pPopupMenu;
 
   // We're sort of misusing KActionCollection here, but we need it for the actionStatusText signal...


--- kdebase-orig/kdebase-3.5.9.dfsg.1/libkonq/konq_popupmenu.cc	2007-10-08 11:51:30.000000000 +0200
+++ kdebase/kdebase-3.5.9.dfsg.1/libkonq/konq_popupmenu.cc	2009-01-24 01:31:18.000000000 +0100
@@ -999,6 +999,9 @@
 KonqPopupMenu::~KonqPopupMenu()
 {
   m_pluginList.clear();
+  m_factory->removeClient(this);
   delete m_factory;
   delete m_builder;
   delete d;
Comment 1 Myriam Schweingruber 2012-06-18 18:22:14 UTC
Message from the Bugsquad and Konqueror teams:
This bug is closed as outdated, as we do not have the manpower to maintain the KDE3 version anymore.
If you still can reproduce this issue with Konqueror 4.8.4 or later, please open a new report.
Thank you for your understanding.