Patch: Crash: blocking JS alert and deleting a window

David Faure david at mandrakesoft.com
Sat Oct 19 09:39:25 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 18 October 2002 23:18, Koos Vriezen wrote:
> Unfortunately removing topLevelWidget() in ecma/kjs_window makes
> 'setTimeout('self.close()',1000); alert("Hi");' crash again, better leave
> it then

Hmm, why? Message boxes created by Window::Alert use the
KHTMLView as parent widget, and there's only one khtmlview in this case......

(or are you talking about the testcase that used window.open?)

> (can JS close a frame?).

Not a frame, but a Konqueror view in a splitted window.
Let me detail this:
those two setups are very different:
* One KHTMLPart in the Konqueror view, with frames inside
* A splitted Konqueror window (using Konqueror's Split options),
with two KHTMLParts.
In the latter case, it's really like having two windows side by side.
window.close() should only destroy one of the views (I believe this
works).

> +void KHTMLView::closeChildDialogs()
> +{
> +    QObjectList *dlgs = queryList("QDialog");
> +    for (QObject *dlg = dlgs->first(); dlg; dlg = dlgs->next())
> +        static_cast<QWidget*>(dlg)->close();
> +    delete dlgs;
>  }

I prefer that one, who knows if we won't have to call it from
another place.

Dirk wrote:
> Am I the only one who is scared like hell when I see such code ?

Yes, well, obviously Qt wasn't designed with this (very unusual) case in mind.
Do you know any other app where a window or widget pops up a modal dialog,
and then, before the user selects something in it, the window or widget is being
destroyed? The "enter_loop" done by the modal dialog has to be exited at
the right time - which isn't in the QWidget destructor of the parent (it's far too late,
the control will go back into the code of the deleted widget).

Dirk also wrote:
> you actually have to revert a workaround I committed yesterday to avoid the 
> crash..
Koos: I believe this is about the !mimeName.isEmpty() in render_frames.cpp:811.

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9sRo972KcVAmwbhARAj/aAKCbq6bRE9OxljPrQBrOfpi94hE9GwCfRono
FptFCWPGJaGe5sHfqNso6FE=
=oxxz
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list