diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-12-20 11:21:27 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-12-22 13:14:26 +0100 |
commit | 2d02bb6c792350b7bc07b029f835bd0223402079 (patch) | |
tree | 88a8dbfb784464b85959515fd7c80170faef65c3 /cui | |
parent | b3e86695022f8db57344f4115ee360072d671838 (diff) |
tdf#156820 Fix crash in custom color picker
which requires
(*) keeping ColorPicker alive during the runAsync in
ColorPicker::startExecuteModal
(*) keeping the PaletteManager alive during the ExecuteAsync in
PaletteManager::PopupCOlorPicker
Noting that MattK debugged the cause of this.
Change-Id: I07efe8e6514f8882b1347c79c6150578c234bb9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161054
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 78ccae0d42d168f845ddbd7cb694d80dfb04f84d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161161
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/colorpicker.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 87f50b534c26..71b0d0970fc3 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -1345,12 +1345,13 @@ void SAL_CALL ColorPicker::setDialogTitle( const OUString& ) void SAL_CALL ColorPicker::startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) { std::shared_ptr<ColorPickerDialog> xDlg = std::make_shared<ColorPickerDialog>(Application::GetFrameWeld(mxParent), mnColor, mnMode); - weld::DialogController::runAsync(xDlg, [this, xDlg, xListener] (sal_Int32 nResult) { + rtl::Reference<ColorPicker> xThis(this); + weld::DialogController::runAsync(xDlg, [xThis, xDlg, xListener] (sal_Int32 nResult) { if (nResult) - mnColor = xDlg->GetColor(); + xThis->mnColor = xDlg->GetColor(); sal_Int16 nRet = static_cast<sal_Int16>(nResult); - css::ui::dialogs::DialogClosedEvent aEvent( *this, nRet ); + css::ui::dialogs::DialogClosedEvent aEvent( *xThis, nRet ); xListener->dialogClosed( aEvent ); }); } |