summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-08-15 12:31:22 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-01 14:41:00 +0200
commit5b82efa7cd0d4801b5176d37d78e7a00dc02ef6b (patch)
treeba85e12b6b224164c7175acbf00e2d48f016b0cd /svx
parent429e376ba42c1380b2f864c4aafce134e6ac14f3 (diff)
Theme dialog: fix crash when closing parent first
When we have 'Add' subdialog opened and we close parent by clicking 'cancel' - subdialog wasn't closed and we had a crash on next interaction with 'Add' subdialog Change-Id: I5865a725e93d7c11aa933b7566a7c584018740ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155715 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156157 Tested-by: Jenkins Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156397
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/ThemeDialog.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx
index 99e7c3ad466e..e3a206be6cab 100644
--- a/svx/source/dialog/ThemeDialog.cxx
+++ b/svx/source/dialog/ThemeDialog.cxx
@@ -8,7 +8,6 @@
*/
#include <svx/dialog/ThemeDialog.hxx>
-#include <svx/dialog/ThemeColorEditDialog.hxx>
#include <docmodel/theme/ColorSet.hxx>
#include <docmodel/theme/Theme.hxx>
#include <svx/ColorSets.hxx>
@@ -22,7 +21,6 @@ ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme)
: GenericDialogController(pParent, "svx/ui/themedialog.ui", "ThemeDialog")
, mpWindow(pParent)
, mpTheme(pTheme)
- , mxSubDialog(false)
, mxValueSetThemeColors(new svx::ThemeColorValueSet)
, mxValueSetThemeColorsWindow(
new weld::CustomWeld(*m_xBuilder, "valueset_theme_colors", *mxValueSetThemeColors))
@@ -45,7 +43,11 @@ ThemeDialog::ThemeDialog(weld::Window* pParent, model::Theme* pTheme)
}
}
-ThemeDialog::~ThemeDialog() = default;
+ThemeDialog::~ThemeDialog()
+{
+ if (mxSubDialog)
+ mxSubDialog->response(RET_CANCEL);
+}
void ThemeDialog::initColorSets()
{
@@ -89,17 +91,16 @@ void ThemeDialog::runThemeColorEditDialog()
if (mxSubDialog)
return;
- auto pDialog = std::make_shared<svx::ThemeColorEditDialog>(mpWindow, *mpCurrentColorSet);
- std::shared_ptr<DialogController> xKeepAlive(shared_from_this());
+ mxSubDialog = std::make_shared<svx::ThemeColorEditDialog>(mpWindow, *mpCurrentColorSet);
- mxSubDialog = weld::DialogController::runAsync(pDialog, [this, pDialog](sal_uInt32 nResult) {
+ weld::DialogController::runAsync(mxSubDialog, [this](sal_uInt32 nResult) {
if (nResult != RET_OK)
{
mxAdd->set_sensitive(true);
- mxSubDialog = false;
+ mxSubDialog = nullptr;
return;
}
- auto aColorSet = pDialog->getColorSet();
+ auto aColorSet = mxSubDialog->getColorSet();
if (!aColorSet.getName().isEmpty())
{
ColorSets::get().insert(aColorSet, ColorSets::IdenticalNameAction::AutoRename);
@@ -113,7 +114,7 @@ void ThemeDialog::runThemeColorEditDialog()
= std::make_shared<model::ColorSet>(maColorSets[maColorSets.size() - 1]);
}
mxAdd->set_sensitive(true);
- mxSubDialog = false;
+ mxSubDialog = nullptr;
});
}