include/svx/fontworkgallery.hxx | 3 ++- svx/source/tbxctrls/fontworkgallery.cxx | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-)
New commits: commit 09f99ae0366ab3f593f17666c9f5860a2fb33538 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Jan 13 10:36:23 2021 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Wed Jan 13 11:08:01 2021 +0100 lok: Prevent from crash on cancel Fontwork dialog Change-Id: Icb24652d6efd46e642efbb91c9941761dd152cab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109219 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx index 54bcb4008e85..9cb79cd80023 100644 --- a/include/svx/fontworkgallery.hxx +++ b/include/svx/fontworkgallery.hxx @@ -57,13 +57,14 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FontWorkGalleryDialog final : public weld::G std::unique_ptr<weld::IconView> maCtlFavorites; std::unique_ptr<weld::Button> mxOKButton; + std::unique_ptr<weld::Button> mxCancelButton; void initFavorites(sal_uInt16 nThemeId); void insertSelectedFontwork(); void fillFavorites(sal_uInt16 nThemeId); DECL_LINK(DoubleClickFavoriteHdl, weld::IconView&, bool); - DECL_LINK(ClickOKHdl, weld::Button&, void ); + DECL_LINK(ClickButtonHdl, weld::Button&, void ); public: FontWorkGalleryDialog(weld::Window* pParent, SdrView& rView); 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) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits