From 73e9a9bd3d58e97de09401e1536877ae913012f9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 5 Nov 2019 17:19:37 +0000 Subject: ensure maEndDialogFn is unset after std::move MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9809cc082157bd18562f812155a9ed68f522a703 Reviewed-on: https://gerrit.libreoffice.org/82084 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/window/dialog.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'vcl/source') diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 3bba7d2fc787..14ea8dae4fdc 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1109,6 +1109,12 @@ void Dialog::EndDialog( long nResult ) if ( mpDialogImpl && mpDialogImpl->maEndCtx.isSet() ) { auto fn = std::move(mpDialogImpl->maEndCtx.maEndDialogFn); + // std::move leaves maEndDialogFn in a valid state with unspecified + // value. For the SwSyncBtnDlg case gcc and msvc left maEndDialogFn + // unset, but clang left maEndDialogFn at its original value, keeping + // an extra reference to the DialogController in its lambda giving + // an inconsistent lifecycle for the dialog. Force it to be unset. + mpDialogImpl->maEndCtx.maEndDialogFn = nullptr; fn(nResult); } -- cgit