[Libreoffice-commits] core.git: cui/source

Yusuf Keten (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 23 06:01:57 UTC 2020


 cui/source/dialogs/AdditionsDialog.cxx |   11 +++++++++++
 cui/source/inc/AdditionsDialog.hxx     |    3 +++
 2 files changed, 14 insertions(+)

New commits:
commit 490f430b2cb18513ae8292e6d1f608ba08e05215
Author:     Yusuf Keten <ketenyusuf at gmail.com>
AuthorDate: Wed Jul 22 20:31:22 2020 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Thu Jul 23 08:01:17 2020 +0200

    tdf#133026: Additions - Thread Execution Termination
    
    After press the close button, the search thread will be terminated after this patch.
    
    Change-Id: Ic79928bf0604203de9497c34cb18dbd76e3f376c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99250
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/cui/source/dialogs/AdditionsDialog.cxx b/cui/source/dialogs/AdditionsDialog.cxx
index 975fa57415fd..37e90c4ecb66 100644
--- a/cui/source/dialogs/AdditionsDialog.cxx
+++ b/cui/source/dialogs/AdditionsDialog.cxx
@@ -418,6 +418,7 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditio
     : GenericDialogController(pParent, "cui/ui/additionsdialog.ui", "AdditionsDialog")
     , m_aSearchDataTimer("SearchDataTimer")
     , m_xEntrySearch(m_xBuilder->weld_entry("entrySearch"))
+    , m_xButtonClose(m_xBuilder->weld_button("buttonClose"))
     , m_xMenuButtonSettings(m_xBuilder->weld_menu_button("buttonGear"))
     , m_xContentWindow(m_xBuilder->weld_scrolled_window("contentWindow"))
     , m_xContentGrid(m_xBuilder->weld_container("contentGrid"))
@@ -430,6 +431,8 @@ AdditionsDialog::AdditionsDialog(weld::Window* pParent, const OUString& sAdditio
     m_xEntrySearch->connect_changed(LINK(this, AdditionsDialog, SearchUpdateHdl));
     m_xEntrySearch->connect_focus_out(LINK(this, AdditionsDialog, FocusOut_Impl));
 
+    m_xButtonClose->connect_clicked(LINK(this, AdditionsDialog, CloseButtonHdl));
+
     m_sTag = OUStringToOString(sAdditionsTag, RTL_TEXTENCODING_UTF8);
 
     OUString titlePrefix = CuiResId(RID_SVXSTR_ADDITIONS_DIALOG_TITLE_PREFIX);
@@ -457,6 +460,7 @@ AdditionsDialog::~AdditionsDialog()
 {
     if (m_pSearchThread.is())
     {
+        m_pSearchThread->StopExecution();
         // Release the solar mutex, so the thread is not affected by the race
         // when it's after the m_bExecute check but before taking the solar
         // mutex.
@@ -530,4 +534,11 @@ IMPL_LINK_NOARG(AdditionsDialog, FocusOut_Impl, weld::Widget&, void)
     }
 }
 
+IMPL_LINK_NOARG(AdditionsDialog, CloseButtonHdl, weld::Button&, void)
+{
+    if (m_pSearchThread.is())
+        m_pSearchThread->StopExecution();
+    this->response(RET_CLOSE);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/AdditionsDialog.hxx b/cui/source/inc/AdditionsDialog.hxx
index be73c78d96d0..7f327b2a8c28 100644
--- a/cui/source/inc/AdditionsDialog.hxx
+++ b/cui/source/inc/AdditionsDialog.hxx
@@ -63,9 +63,12 @@ private:
     DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
     DECL_LINK(ImplUpdateDataHdl, Timer*, void);
     DECL_LINK(FocusOut_Impl, weld::Widget&, void);
+    DECL_LINK(CloseButtonHdl, weld::Button&, void);
 
 public:
     std::unique_ptr<weld::Entry> m_xEntrySearch;
+    std::unique_ptr<weld::Button> m_xButtonClose;
+
     std::unique_ptr<weld::MenuButton> m_xMenuButtonSettings;
     std::vector<AdditionsItem> m_aAdditionsItems;
 


More information about the Libreoffice-commits mailing list