diff options
author | Antony <antonydas.nadar@collabora.com> | 2024-03-14 15:24:11 +0530 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-27 12:15:51 +0100 |
commit | 896d6303040cb86813f1c5bc06bb830f512f3f22 (patch) | |
tree | d09e40a56aed08827604e89b758206fc2788c29f /sw/source/ui/misc | |
parent | 26c30fd77bf31ad8c14da1413aaa61fa8aa45206 (diff) |
cool#8456 : Convert bookmark rename dialog to async
* Changed bookmark rename dialog from synchronous to asynchronous execution.
* Removed the reference operator from variables m_xNamed and m_xNameAccess declared in swrenamexnameddlg.hxx to prevent use-after-free
Change-Id: I2e4e777c5c56137504b646bdbe82e265ef73b2ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164803
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 1222d98eaad463e35286f215b3bdeb909ea155bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165323
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/ui/misc')
-rw-r--r-- | sw/source/ui/misc/bookmark.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 6431809c9569..40cebea7ead7 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -215,20 +215,23 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, weld::Button&, void) aObj >>= xTmp; uno::Reference<container::XNamed> xNamed(xTmp, uno::UNO_QUERY); SwAbstractDialogFactory& rFact = swui::GetFactory(); - ScopedVclPtr<AbstractSwRenameXNamedDlg> pDlg( + VclPtr<AbstractSwRenameXNamedDlg> pDlg( rFact.CreateSwRenameXNamedDlg(m_xDialog.get(), xNamed, xNameAccess)); pDlg->SetForbiddenChars(BookmarkTable::aForbiddenChars + OUStringChar(BookmarkTable::s_cSeparator)); - if (pDlg->Execute()) - { - ValidateBookmarks(); - m_xDeleteBtn->set_sensitive(false); - m_xGotoBtn->set_sensitive(false); - m_xEditTextBtn->set_sensitive(false); - m_xRenameBtn->set_sensitive(false); - m_xInsertBtn->set_sensitive(false); - } + pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult) { + if (nResult == RET_OK) + { + ValidateBookmarks(); + m_xDeleteBtn->set_sensitive(false); + m_xGotoBtn->set_sensitive(false); + m_xEditTextBtn->set_sensitive(false); + m_xRenameBtn->set_sensitive(false); + m_xInsertBtn->set_sensitive(false); + } + pDlg->disposeOnce(); + }); } // callback to an insert button. Inserts a new text mark to the current position. |