[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    On the crash with the sidebar's "Hide config button" entry...
From:       Maks Orlovich <mo002j () mail ! rochester ! edu>
Date:       2003-02-27 3:36:17
[Download RAW message or body]

Hi..

Currently, Konqueror crashes if you click on the Wrench icon in the sidebar, 
and uncheck the  "Show Configuration Button" entry. This occurs because a 
deleteLater request to remove the button gets handled in the inner event loop 
for the popup menu, deleting the button that initiated the .exec() on the 
menu while its member function is still executing (See the valgrind output 
below for more details). It's possible to workaround this (attached); but the 
patch is extraordinarily ugly and hacky, and I don't see a better way. 
I think the better option would be to just kill this menu entry, at least when 
invoked from the wrench button. If this is agreed to, I'll make a patch to do 
this. This arguably one piece of configurability that we don't need.

At any rate, IMHO, crashing on invocation of a menu entry, no matter how 
obscure, during regular use, is unacceptible and hence I'd suggest that this 
bug is a showstopper for 3.1.1

---------------------

==8567==
==8567== Invalid read of size 4
==8567==    at 0x40D7C6CF: QPushButton::popupPressed() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40F5615B: QPushButton::qt_invoke(int, QUObject*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x491214E0: KMultiTabBarButton::qt_invoke(int, QUObject*) (in 
/code/opt/kde3/lib/libkmultitabbar.so.0.0.0)
==8567==    by 0x40C88608: QObject::activate_signal(QConnectionList*, 
QUObject*) (in /usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C884AC: QObject::activate_signal(int) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40F472CA: QButton::pressed() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40D0A9B7: QButton::mousePressEvent(QMouseEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40CBC6EA: QWidget::event(QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28C73: QApplication::internalNotify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C284A2: QApplication::notify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x408BE54D: KApplication::notify(QObject*, QEvent*) (in 
/code/opt/kde3/lib/libkdecore.so.4.2.0)
==8567==    by 0x40BCEB67: QETWidget::translateMouseEvent(_XEvent const*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40BCC6AE: QApplication::x11ProcessEvent(_XEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40BE1769: QEventLoop::processEvents(unsigned) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C3E595: QEventLoop::enterLoop() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C3E437: QEventLoop::exec() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28EA0: QApplication::exec() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x4023E664: main (in /code/opt/kde3/lib/konqueror.so)
==8567==    by 0x412AF796: __libc_start_main (in /lib/i686/libc-2.3.1.so)
==8567==    by 0x8048510: (within /code/opt/kde3/bin/konqueror)
==8567==    Address 0x43DCB64C is 0 bytes inside a block of size 152 free'd
==8567==    at 0x4015D8C8: __builtin_delete (vg_clientfuncs.c:196)
==8567==    by 0x4015D8E8: operator delete(void*) (vg_clientfuncs.c:205)
==8567==    by 0x49124638: KMultiTabBarButton::~KMultiTabBarButton() (in 
/code/opt/kde3/lib/libkmultitabbar.so.0.0.0)
==8567==    by 0x40C86242: QObject::event(QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40CBC67B: QWidget::event(QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28C73: QApplication::internalNotify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28868: QApplication::notify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x408BE54D: KApplication::notify(QObject*, QEvent*) (in 
/code/opt/kde3/lib/libkdecore.so.4.2.0)
==8567==    by 0x40C29A09: QApplication::sendPostedEvents(QObject*, int) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C29887: QApplication::sendPostedEvents() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40BE110D: QEventLoop::processEvents(unsigned) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C3E595: QEventLoop::enterLoop() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28F00: QApplication::enter_loop() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40D78C25: QPopupMenu::exec(QPoint const&, int) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40D7C6CB: QPushButton::popupPressed() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40F5615B: QPushButton::qt_invoke(int, QUObject*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x491214E0: KMultiTabBarButton::qt_invoke(int, QUObject*) (in 
/code/opt/kde3/lib/libkmultitabbar.so.0.0.0)
==8567==    by 0x40C88608: QObject::activate_signal(QConnectionList*, 
QUObject*) (in /usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C884AC: QObject::activate_signal(int) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40F472CA: QButton::pressed() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40D0A9B7: QButton::mousePressEvent(QMouseEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40CBC6EA: QWidget::event(QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28C73: QApplication::internalNotify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C284A2: QApplication::notify(QObject*, QEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x408BE54D: KApplication::notify(QObject*, QEvent*) (in 
/code/opt/kde3/lib/libkdecore.so.4.2.0)
==8567==    by 0x40BCEB67: QETWidget::translateMouseEvent(_XEvent const*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40BCC6AE: QApplication::x11ProcessEvent(_XEvent*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40BE1769: QEventLoop::processEvents(unsigned) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C3E595: QEventLoop::enterLoop() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C3E437: QEventLoop::exec() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x40C28EA0: QApplication::exec() (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x4023E664: main (in /code/opt/kde3/lib/konqueror.so)
==8567==
==8567== Jump to the invalid address stated on the next line
==8567==    at 0x2: ???
==8567==    by 0x40F5615B: QPushButton::qt_invoke(int, QUObject*) (in 
/usr/lib/qt3/lib/libqt-mt.so.3.1.1)
==8567==    by 0x491214E0: KMultiTabBarButton::qt_invoke(int, QUObject*) (in
["dont_crash.diff" (text/x-diff)]

? dont_crash.diff
? trees/bookmark_module/core.3788
? trees/history_module/core.2465
Index: sidebar_widget.cpp
===================================================================
RCS file: /home/kde/kdebase/konqueror/sidebar/sidebar_widget.cpp,v
retrieving revision 1.83
diff -u -3 -p -r1.83 sidebar_widget.cpp
--- sidebar_widget.cpp	6 Jan 2003 21:34:50 -0000	1.83
+++ sidebar_widget.cpp	23 Feb 2003 03:51:51 -0000
@@ -14,6 +14,8 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
+
+#include <kapplication.h>
 #include <klocale.h>
 #include <ksimpleconfig.h>
 #include <kstandarddirs.h>
@@ -464,11 +466,33 @@ void Sidebar_Widget::activatedMenu(int i
 				i18n("You have hidden the navigation panel configuration button. To make it \
visible again, click the right mouse button on any of the navigation panel buttons \
and select \"Show Configuration Button\"."));  
 
-				ButtonBar->removeButton(-1);
+				QTimer::singleShot(10, this, SLOT(slotTryDeleteConfigButton() ) );
+
 //JW -TEST				ButtonBar->removeButton(-2);
 			}
 			break;
 		}
+	}
+}
+
+/**
+We absolutely have to remove this button from the top
+loop, otherwise we may end up killing it while we're nested inside the .exec() call \
from the button we're trying to remove. Hence this nasty hack. +
+*/
+void Sidebar_Widget::slotTryDeleteConfigButton()
+{
+	if (showExtraButtons)
+		return;
+
+	if (kapp->loopLevel() > 1) //Try in a bit
+	{
+		QTimer::singleShot(10, this, SLOT(slotTryDeleteConfigButton()));
+	}
+	else
+	{
+		//Safe!
+		ButtonBar->removeButton(-1);
 	}
 }
 
Index: sidebar_widget.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/sidebar/sidebar_widget.h,v
retrieving revision 1.38
diff -u -3 -p -r1.38 sidebar_widget.h
--- sidebar_widget.h	6 Jan 2003 21:25:29 -0000	1.38
+++ sidebar_widget.h	23 Feb 2003 03:51:51 -0000
@@ -126,6 +126,8 @@ class Sidebar_Widget: public QWidget
 	friend class ButtonInfo;
 	QGuardedPtr<ButtonInfo>activeModule;
   protected slots:
+	void slotTryDeleteConfigButton();
+
 	void showHidePage(int value);
 	void createButtons();
 	void finishRollBack();



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic