summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-01-13 10:36:23 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2021-01-13 11:08:01 +0100
commit09f99ae0366ab3f593f17666c9f5860a2fb33538 (patch)
treefcdf928618297314bed9e033013bd8015565b3e5 /svx
parentf3bedf92fb8d07114bc3d53d8a01928c77e479fc (diff)
lok: Prevent from crash on cancel Fontwork dialog
Change-Id: Icb24652d6efd46e642efbb91c9941761dd152cab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109219 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 69055a0be856..edd3748400fb 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -72,12 +72,14 @@ FontWorkGalleryDialog::FontWorkGalleryDialog(weld::Window* pParent, SdrView& rSd
, mpDestModel(nullptr)
, maCtlFavorites(m_xBuilder->weld_icon_view("ctlFavoriteswin"))
, mxOKButton(m_xBuilder->weld_button("ok"))
+ , mxCancelButton(m_xBuilder->weld_button("cancel"))
{
Size aSize(530, 400);
maCtlFavorites->set_size_request(aSize.Width(), aSize.Height());
maCtlFavorites->connect_item_activated( LINK( this, FontWorkGalleryDialog, DoubleClickFavoriteHdl ) );
- mxOKButton->connect_clicked(LINK(this, FontWorkGalleryDialog, ClickOKHdl));
+ mxOKButton->connect_clicked(LINK(this, FontWorkGalleryDialog, ClickButtonHdl));
+ mxCancelButton->connect_clicked(LINK(this, FontWorkGalleryDialog, ClickButtonHdl));
initFavorites( GALLERY_THEME_FONTWORK );
fillFavorites( GALLERY_THEME_FONTWORK );
@@ -229,10 +231,17 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
}
}
-IMPL_LINK_NOARG(FontWorkGalleryDialog, ClickOKHdl, weld::Button&, void)
+IMPL_LINK(FontWorkGalleryDialog, ClickButtonHdl, weld::Button&, rButton, void)
{
- insertSelectedFontwork();
- m_xDialog->response(RET_OK);
+ if (&rButton == mxOKButton.get())
+ {
+ insertSelectedFontwork();
+ m_xDialog->response(RET_OK);
+ }
+ else
+ {
+ m_xDialog->response(RET_CANCEL);
+ }
}
IMPL_LINK_NOARG(FontWorkGalleryDialog, DoubleClickFavoriteHdl, weld::IconView&, bool)