The NetAccess hack hits again

Waldo Bastian bastian at kde.org
Mon Apr 29 20:02:13 BST 2002


On Monday 29 April 2002 09:02 am, David Faure wrote:
> Bug: type something in KWord, File/SaveAs, type filename, Ok -> can't type
> anymore. It turns out that focusWidget() is 0L in the kword mainwindow, and
> that it never got the FocusIn event.
>
> (If your kio is uptodate you'll need to upload to an FTP location to see
> this, I have changed NetAccess::exists for local files).
>
> One can also see an X error. Its backtrace is below.
> Does anyone know what the X error means? man XCheckIfEvent really didn't
> help... I tried deleting the file dialog before calling NetAccess (usually
> it's destroyed afterwards), but that didn't change anything.

I have seen similar X errors when showing messageboxes back-to-back without 
calling the event loop in between. Maybe that happens here as well ??? E.g. 
the NetAccess hack-dialog being shown directly after closing the 
saveAs-dialog?

*Yay* I even managed to reproduce it!

Use the following code:

    new KApplication( argc, argv, "MyApplication" );

    ExampleWidget *w = new ExampleWidget();
    w->show();    
    KMessageBox::queuedMessageBox(w, KMessageBox::WarningYesNo, "Hello World! 
(#1)");
    KMessageBox::queuedMessageBox(w, KMessageBox::WarningYesNo, "Hello World! 
(#2)");
    KMessageBox::queuedMessageBox(w, KMessageBox::WarningYesNo, "Hello World! 
(#3)");
    kapp->exec();    

ExampleWidget can be anything, a QLabel or so.

With normal KDE this will work just fine.

Now change the following line around kdialog.cpp:231
From:

   if (d->queue.count())
      QTimer::singleShot(20, this, SLOT(slotShowQueuedDialog()));
   else
      ksdkdq.destructObject(); // Suicide.

To:

   if (d->queue.count())
      slotShowQueuedDialog();
   else
      ksdkdq.destructObject(); // Suicide.

And you will get:
MyApplication: WARNING: KDE detected X Error: BadMatch (invalid parameter 
attributes) 8
  Major opcode:  42

The code in kdialog is repsonsible for showing the dialogs one after the 
other.

Cheers,
Waldo
-- 
bastian at kde.org  |   SuSE Labs KDE Developer  |  bastian at suse.com





More information about the kde-core-devel mailing list