sd/source/ui/func/funavig.cxx |   27 ++++++++++++++++++++++-----
 sd/source/ui/inc/funavig.hxx  |    2 ++
 2 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit b624bddb73ae0e8f3dbab18f85d11ff355cba766
Author:     Hubert Figuière <h...@collabora.com>
AuthorDate: Wed Jul 16 13:07:01 2025 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jul 17 08:56:52 2025 +0200

    sd: Make the GotoPage dialog async
    
    Signed-off-by: Hubert Figuière <h...@collabora.com>
    Change-Id: I2a4a8d204f448de961ca0bcd76928e49c280167a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187972
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx
index ca7565c8ba49..6fd8e003a6d3 100644
--- a/sd/source/ui/func/funavig.cxx
+++ b/sd/source/ui/func/funavig.cxx
@@ -160,15 +160,32 @@ void FuNavigation::DoExecute( SfxRequest& rReq )
                         sTitle = SdResId(STR_GOTO_SLIDE_DLG_TITLE);
                         sLabel = SdResId(STR_SLIDE_NAME) + ":";
                     }
-                    svx::GotoPageDlg aDlg(pDrawViewShell->GetFrameWeld(), 
sTitle, sLabel,
-                         pDrawViewShell->GetCurPagePos() + 1,
-                         mpDoc->GetSdPageCount(PageKind::Standard));
-                    if (aDlg.run() == RET_OK)
-                        pDrawViewShell->SwitchPage(aDlg.GetPageSelection() - 
1);
+                    std::shared_ptr<SfxRequest> xRequest = 
std::make_shared<SfxRequest>(rReq);
+                    rReq.Ignore(); // the 'old' request is not relevant any 
more
+
+                    auto xDialog = 
std::make_shared<svx::GotoPageDlg>(pDrawViewShell->GetFrameWeld(), sTitle, 
sLabel,
+                        pDrawViewShell->GetCurPagePos() + 1,
+                        mpDoc->GetSdPageCount(PageKind::Standard));
+
+                    rtl::Reference<FuNavigation> xThis( this ); // avoid 
destruction within async processing
+                    weld::DialogController::runAsync(xDialog, [this, xDialog, 
xRequest, xThis](sal_uInt32 nResult) {
+                        if (nResult == RET_OK)
+                            
static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(xDialog->GetPageSelection()
 - 1);
+                        xThis->Finish();
+                        xRequest->Done();
+                    });
+
+                    return;
                 }
         }
         break;
     }
+
+    Finish();
+}
+
+void FuNavigation::Finish()
+{
     // Refresh toolbar icons
     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
     rBindings.Invalidate(SID_GO_TO_FIRST_PAGE);
diff --git a/sd/source/ui/inc/funavig.hxx b/sd/source/ui/inc/funavig.hxx
index a802b2f8bd5e..791947f58ef7 100644
--- a/sd/source/ui/inc/funavig.hxx
+++ b/sd/source/ui/inc/funavig.hxx
@@ -39,6 +39,8 @@ private:
         ::sd::View* pView,
         SdDrawDocument* pDoc,
         SfxRequest& rReq);
+
+    void Finish();
 };
 
 } // end of namespace sd

Reply via email to