diff options
author | Michael BrĂ¼ning <michael.bruning@digia.com> | 2014-06-27 17:40:49 +0200 |
---|---|---|
committer | Michael Bruning <michael.bruning@digia.com> | 2014-06-30 11:11:09 +0200 |
commit | 0058d5b9dd56ba0453be3297231484917441f7f7 (patch) | |
tree | 617dfd98e1e19a29ba3ee0b9329deb983b8a584e /src/core/javascript_dialog_controller.cpp | |
parent | 212ff1b00af7642e0416f8e8f83dc3964377195d (diff) |
Prevent premature deletion of JavaScript alert dialog object.
This fixes a crash on Windows when dismissing a JavaScript dialog.
It was caused by the JavaScriptDialogController object deleting
itself and its private object from a method call and subsequently
trying to run the JavaScript dialog callback.
Task-number: QTBUG-39883
Change-Id: I74300c53943ec7ebc492362ef7d75d83aa1f8051
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'src/core/javascript_dialog_controller.cpp')
-rw-r--r-- | src/core/javascript_dialog_controller.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/javascript_dialog_controller.cpp b/src/core/javascript_dialog_controller.cpp index c3c133a0d..d789b184f 100644 --- a/src/core/javascript_dialog_controller.cpp +++ b/src/core/javascript_dialog_controller.cpp @@ -47,8 +47,9 @@ void JavaScriptDialogControllerPrivate::dialogFinished(bool accepted, const base::string16 &promptValue) { - // Clear the queue first as this could result in the engine asking us to run another dialog. - JavaScriptDialogManagerQt::GetInstance()->removeDialogForContents(contents); + // Clear the queue first as this could result in the engine asking us to run another dialog, + // but hold a shared pointer so the dialog does not get deleted prematurely when running in-process. + QSharedPointer<JavaScriptDialogController> dialog = JavaScriptDialogManagerQt::GetInstance()->takeDialogForContents(contents); callback.Run(accepted, promptValue); } |