[Libreoffice-commits] core.git: vcl/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Sat Sep 28 09:00:01 UTC 2019
vcl/source/window/dialog.cxx | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
New commits:
commit ab09184efffdd70c5c89f20895132c7900777f7d
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Sep 27 22:04:49 2019 +0100
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Sep 28 10:59:26 2019 +0200
Avoid lambda being destroyed while it is being called.
Also armor against mpDialogImpl going down during EndDialog.
This can happen during an insert chart wizard cancel, as
out of place embedded dialog cleanup occurs.
Change-Id: I1b666f07d4ec72e07fdf6888cea44a5a13976073
Reviewed-on: https://gerrit.libreoffice.org/79772
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/79778
Tested-by: Jenkins
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1748abd0272a..080b64416e01 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1163,13 +1163,13 @@ void Dialog::EndDialog( long nResult )
if ( mpDialogImpl->mbStartedModal )
ImplEndExecuteModal();
- if (mpDialogImpl->maEndCtx.isSet())
+ if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() )
{
- mpDialogImpl->maEndCtx.maEndDialogFn(nResult);
- mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
+ auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn);
+ fn(nResult);
}
- if ( mpDialogImpl->mbStartedModal )
+ if ( mpDialogImpl && mpDialogImpl->mbStartedModal )
{
mpDialogImpl->mbStartedModal = false;
mpDialogImpl->mnResult = -1;
@@ -1177,12 +1177,15 @@ void Dialog::EndDialog( long nResult )
mbInExecute = false;
- // Destroy ourselves (if we have a context with VclPtr owner)
- std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
- std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
- mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
- xOwnerDialogController.reset();
- xOwnerSelf.reset();
+ if ( mpDialogImpl )
+ {
+ // Destroy ourselves (if we have a context with VclPtr owner)
+ std::shared_ptr<weld::DialogController> xOwnerDialogController = std::move(mpDialogImpl->maEndCtx.mxOwnerDialogController);
+ std::shared_ptr<weld::Dialog> xOwnerSelf = std::move(mpDialogImpl->maEndCtx.mxOwnerSelf);
+ mpDialogImpl->maEndCtx.mxOwner.disposeAndClear();
+ xOwnerDialogController.reset();
+ xOwnerSelf.reset();
+ }
}
void Dialog::EndAllDialogs( vcl::Window const * pParent )
More information about the Libreoffice-commits
mailing list