svx/source/dialog/ThemeDialog.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit 1629ac1ffd5b0543f66f45cdc51ca51682841a7e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 24 10:16:11 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jul 24 19:10:06 2023 +0200 fix COOL crash in theme dialog ==3975==ERROR: AddressSanitizer: heap-use-after-free /opt/collaboraoffice/program/libmergedlo.so std::vector<model::ColorSet, std::allocator<model::ColorSet> >::clear() /home/collabora/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_vector.h:1248 /opt/collaboraoffice/program/libmergedlo.so operator() /home/collabora/online-buildscripts/staging/builddir/libreoffice/svx/source/dialog/ThemeDialog.cxx:96 /opt/collaboraoffice/program/libmergedlo.so std::function<void (int)>::operator()(int) const /home/collabora/lode/opt_private/gcc-7.3.0/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/std_function.h:706 /opt/collaboraoffice/program/libmergedlo.so Dialog::EndDialog(long) /home/collabora/online-buildscripts/staging/builddir/libreoffice/vcl/source/window/dialog.cxx:1192 /opt/collaboraoffice/program/libmergedlo.so jsdialog::ExecuteAction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rtl::OString const&, std::map<rtl::OUString, rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, rtl::OUString> > >&) /home/collabora/online-buildscripts/staging/builddir/libreoffice/vcl/jsdialog/executor.cxx:566 /opt/collaboraoffice/program/libmergedlo.so lcl_sendDialogEvent(unsigned long long, char const*) /home/collabora/online-buildscripts/staging/builddir/libreoffice/desktop/source/lib/init.cxx:4735 /usr/bin/coolforkit lok::Document::sendDialogEvent(unsigned long long, char const*) /home/collabora/online-buildscripts/staging/builddir/libreoffice/include/LibreOfficeKit/LibreOfficeKit.hxx:323 /usr/bin/coolforkit Change-Id: I7b34c9649c96f6745c2230ac347644fb45ec7f6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154836 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit 2ee535bfdb089511261daff20e515714ed2c0563) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154851 Tested-by: Jenkins (cherry picked from commit 40a3a1d652b1581e537c4bffdb913b22694ac535) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154856 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svx/source/dialog/ThemeDialog.cxx b/svx/source/dialog/ThemeDialog.cxx index 8af6f5975df2..29d12f25c779 100644 --- a/svx/source/dialog/ThemeDialog.cxx +++ b/svx/source/dialog/ThemeDialog.cxx @@ -86,7 +86,8 @@ IMPL_LINK_NOARG(ThemeDialog, SelectItem, ValueSet*, void) void ThemeDialog::runThemeColorEditDialog() { auto pDialog = std::make_shared<svx::ThemeColorEditDialog>(mpWindow, *mpCurrentColorSet); - weld::DialogController::runAsync(pDialog, [this, pDialog](sal_uInt32 nResult) { + std::shared_ptr<DialogController> xKeepAlive(shared_from_this()); + weld::DialogController::runAsync(pDialog, [this, xKeepAlive, pDialog](sal_uInt32 nResult) { if (nResult != RET_OK) return; auto aColorSet = pDialog->getColorSet();