diff options
author | Yusuf Keten <ketenyusuf@gmail.com> | 2020-07-22 20:31:22 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2020-07-23 08:01:17 +0200 |
commit | 490f430b2cb18513ae8292e6d1f608ba08e05215 (patch) | |
tree | 2e035709b9e78b054abf07fb5eb11ca8d60b35d0 /cui | |
parent | eaf55518621b1fe08a60aec98b4367d7ad722cb9 (diff) |
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@collabora.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/AdditionsDialog.cxx | 11 | ||||
-rw-r--r-- | cui/source/inc/AdditionsDialog.hxx | 3 |
2 files changed, 14 insertions, 0 deletions
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; |