PATCH [ was: Re: Showstopper with Qt 3.1.2? ]

Matthias Ettrich ettrich at trolltech.com
Wed Mar 5 13:53:17 GMT 2003


On Wednesday 05 March 2003 00:28, Stephan Binner wrote:
> Hello,
>
> please try this with Qt 3.1.2: Start Konsole or KEdit and call "Edit/Find
> [in History]...", don't enter anything but "Close" and call "Find" again.
>
> Here the second time the dialog hides immediately (and as a side-effect
> selection in Konsole will not work anymore and Konsole crashes at exit)
> caused by endless repeated calling of KDialogBase::slotClose(). :-(
>
> I suppose something is broken deep within Qt 3.1.2.

This is a tough one. We received many reports about QWidget::close() in 3.1 no 
longer sending a close event to hidden widgets, so we had to do something 
about this. In addition, users were asking to receive close events (and gain 
close handling, like the QApplication::lastWindowClosed() signal, etc.) when 
calling QDialog::accept()/reject() which both call QDialog::done().

Now, KDialogbase in closeEvent() invokes a timer (through 
QButton::animateClick() ), which calls QDialog::reject(), which calls close() 
which sends a close event, and so on.

For the time being we do not see a fix for all issues, and we haven't seen 
problems other than KDialogBase yet. A possibility is to make 
QButton::animateClick() work for shown buttons only, but this is likely to 
break even more code.

Here's a simple fix to KDialogBase:

Index: kdialogbase.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kdialogbase.cpp,v
retrieving revision 1.78
diff -d -u -r1.78 kdialogbase.cpp
--- kdialogbase.cpp     30 Jan 2003 18:55:35 -0000      1.78
+++ kdialogbase.cpp     5 Mar 2003 13:56:21 -0000
@@ -1546,7 +1546,7 @@
 void KDialogBase::closeEvent( QCloseEvent *e )
 {
     QPushButton *pb = actionButton( mEscapeButton );
-    if( pb != 0 ) {
+    if( pb != 0 && isShown() ) {
        pb->animateClick();
     } else {
        QDialog::closeEvent( e );


Matthias




More information about the kde-core-devel mailing list