[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - include/svx svx/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 13 10:08:44 UTC 2021


 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.klos at collabora.com>
AuthorDate: Wed Jan 13 10:36:23 2021 +0100
Commit:     Szymon Kłos <szymon.klos at 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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at 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)


More information about the Libreoffice-commits mailing list