Patch: Crash: blocking JS alert and deleting a window
Simon Hausmann
hausmann at kde.org
Fri Oct 18 13:42:05 BST 2002
On Fri, Oct 18, 2002 at 02:33:05PM +0200, Koos Vriezen wrote:
> Hi,
>
> The crashes with the test cases below, can be fixed by closing all dialogs
> of this view before doing a 'Window::DelayedAction( Window::DelayedClose )'
>
>
> Index: ecma/kjs_window.cpp
> ===================================================================
> RCS file: /home/kde/kdelibs/khtml/ecma/kjs_window.cpp,v
> retrieving revision 1.277
> diff -u -3 -p -r1.277 kjs_window.cpp
> --- ecma/kjs_window.cpp 2002/10/07 15:57:33 1.277
> +++ ecma/kjs_window.cpp 2002/10/18 12:24:24
> @@ -32,6 +32,7 @@
> #include <kconfig.h>
> #include <assert.h>
> #include <qstyle.h>
> +#include <qobjectlist.h>
>
> #include <kjs/collector.h>
> #include "kjs_proxy.h"
> @@ -1336,6 +1337,12 @@ Value WindowFunc::tryCall(ExecState *exe
> // then schedule a delayed close (so that the script terminates first).
> // But otherwise, close immediately. This fixes
> w=window.open("","name");w.close();window.open("name");
> if ( Window::retrieveActive(exec) == window ) {
> + if (widget) {
> + // quit all modal dialogs of this view
> + QObjectList * dlgs = widget->topLevelWidget()->queryList("QDialog");
> + for (QObject* dlg = dlgs->first(); dlg; dlg = dlgs->next())
> + ((QDialog*)dlg)->hide();
In any case don't forget 'delete dlgs;' :)
Simon
More information about the kfm-devel
mailing list