This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 55c04d1336 Run the remaining Extension Manager dialogs on the main 
thread
55c04d1336 is described below

commit 55c04d1336cb0228ec67f5ea1b5d7cd6aa993e7d
Author: Jim Jagielski <[email protected]>
AuthorDate: Fri Aug 7 17:36:04 2026 -0400

    Run the remaining Extension Manager dialogs on the main thread
---
 .../source/deployment/gui/dp_gui_dialog2.cxx       | 12 ++++
 .../source/deployment/gui/dp_gui_dialog2.hxx       |  1 +
 .../deployment/gui/dp_gui_extensioncmdqueue.cxx    | 60 +++++++++++++-----
 .../gui/dp_gui_handleversionexception.cxx          | 74 +++++++++++++---------
 4 files changed, 101 insertions(+), 46 deletions(-)

diff --git a/main/desktop/source/deployment/gui/dp_gui_dialog2.cxx 
b/main/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index f08a9e6408..362ea5d478 100644
--- a/main/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/main/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -43,6 +43,7 @@
 #include "vcl/msgbox.hxx"
 #include "vcl/scrbar.hxx"
 #include "vcl/svapp.hxx"
+#include "vcl/threadex.hxx"
 
 #include "vos/mutex.hxx"
 
@@ -75,6 +76,7 @@
 
 #include <map>
 #include <vector>
+#include <boost/bind.hpp>
 #include <boost/shared_ptr.hpp>
 
 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
@@ -640,6 +642,16 @@ void DialogHelper::openWebBrowser( const OUString & sURL, 
const OUString &sTitle
 
 
//------------------------------------------------------------------------------
 bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
+{
+       // Reached from the deployment worker thread, where 
AquaSalInstance::Yield
+       // cannot pump the Cocoa event queue; the dialog must execute on the 
main
+       // thread or it appears but never receives events.
+       return vcl::solarthread::syncExecute(
+               boost::bind( &DialogHelper::solar_installExtensionWarn, this, 
rExtensionName ) );
+}
+
+//------------------------------------------------------------------------------
+bool DialogHelper::solar_installExtensionWarn( const OUString &rExtensionName 
) const
 {
        const ::vos::OGuard guard( Application::GetSolarMutex() );
        WarningBox aInfo( m_pVCLWindow, getResId( 
RID_WARNINGBOX_INSTALL_EXTENSION ) );
diff --git a/main/desktop/source/deployment/gui/dp_gui_dialog2.hxx 
b/main/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index b4ee89652d..6843709711 100644
--- a/main/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/main/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -95,6 +95,7 @@ public:
     void            setBusy( const bool bBusy ) { m_bIsBusy = bBusy; }
     bool            isBusy() const { return m_bIsBusy; }
     bool            installExtensionWarn( const ::rtl::OUString &rExtensionURL 
) const;
+    bool            solar_installExtensionWarn( const ::rtl::OUString 
&rExtensionURL ) const;
     bool            installForAllUsers( bool &bInstallForAll ) const;
 };
 
diff --git a/main/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx 
b/main/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 5b9137c1ec..c0da1dd286 100644
--- a/main/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/main/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -347,6 +347,41 @@ uno::Reference< ucb::XProgressHandler > 
ProgressCmdEnv::getProgressHandler()
     return this;
 }
 
+//------------------------------------------------------------------------------
+namespace {
+
+// The bodies below are reached from the deployment worker thread, where
+// AquaSalInstance::Yield cannot pump the Cocoa event queue; a dialog executed 
there
+// appears but never receives events. syncExecute() marshals them onto the 
main thread.
+
+short solar_dependencyDialog( DialogHelper * pDialogHelper,
+                              std::vector< OUString > const & rDeps )
+{
+    vos::OGuard guard( Application::GetSolarMutex() );
+    return DependencyDialog( pDialogHelper ? pDialogHelper->getWindow() : 
NULL, rDeps ).Execute();
+}
+
+void solar_unsupportedPlatformBox( DialogHelper * pDialogHelper,
+                                   OUString const & rDisplayName )
+{
+    vos::OGuard guard( Application::GetSolarMutex() );
+    String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, 
*DeploymentGuiResMgr::get() ) );
+    sMsg.SearchAndReplaceAllAscii( "%Name", rDisplayName );
+    ErrorBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, WB_OK, 
sMsg );
+    box.Execute();
+}
+
+void solar_errorBox( DialogHelper * pDialogHelper, OUString const & rMsg, bool 
bSetTitle )
+{
+    vos::OGuard guard( Application::GetSolarMutex() );
+    ErrorBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, WB_OK, 
rMsg );
+    if ( bSetTitle && pDialogHelper )
+        box.SetText( pDialogHelper->getWindow()->GetText() );
+    box.Execute();
+}
+
+} // anon namespace
+
 
//------------------------------------------------------------------------------
 // XInteractionHandler
 
//------------------------------------------------------------------------------
@@ -415,8 +450,8 @@ void ProgressCmdEnv::handle( uno::Reference< 
task::XInteractionRequest > const &
                 dp_misc::Dependencies::getErrorText( 
depExc.UnsatisfiedDependencies[i]) );
         }
         {
-            vos::OGuard guard(Application::GetSolarMutex());
-            short n = DependencyDialog( m_pDialogHelper? 
m_pDialogHelper->getWindow() : NULL, deps ).Execute();
+            short n = vcl::solarthread::syncExecute(
+                boost::bind( &solar_dependencyDialog, m_pDialogHelper, deps ) 
);
             // Distinguish between closing the dialog and programatically
             // canceling the dialog (headless VCL):
             approve = n == RET_OK
@@ -465,11 +500,9 @@ void ProgressCmdEnv::handle( uno::Reference< 
task::XInteractionRequest > const &
        }
     else if (request >>= platExc)
     {
-        vos::OGuard guard( Application::GetSolarMutex() );
-        String sMsg( ResId( RID_STR_UNSUPPORTED_PLATFORM, 
*DeploymentGuiResMgr::get() ) );
-        sMsg.SearchAndReplaceAllAscii( "%Name", 
platExc.package->getDisplayName() );
-        ErrorBox box( m_pDialogHelper? m_pDialogHelper->getWindow() : NULL, 
WB_OK, sMsg );
-        box.Execute();
+        vcl::solarthread::syncExecute(
+            boost::bind( &solar_unsupportedPlatformBox, m_pDialogHelper,
+                         platExc.package->getDisplayName() ) );
         approve = true;
     }
 
@@ -539,9 +572,8 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
         if ( text.getLength() == 0 )
             text = ::comphelper::anyToString( rStatus ); // fallback
 
-        const ::vos::OGuard aGuard( Application::GetSolarMutex() );
-        const ::std::auto_ptr< ErrorBox > aBox( new ErrorBox( m_pDialogHelper? 
m_pDialogHelper->getWindow() : NULL, WB_OK, text ) );
-        aBox->Execute();
+        vcl::solarthread::syncExecute(
+            boost::bind( &solar_errorBox, m_pDialogHelper, text, false ) );
     }
     ++m_nCurrentProgress;
     updateProgress();
@@ -830,12 +862,8 @@ void ExtensionCmdQueue::Thread::execute()
                 if (msg.getLength() == 0) // fallback for debugging purposes
                     msg = ::comphelper::anyToString(exc);
 
-                const ::vos::OGuard guard( Application::GetSolarMutex() );
-                ::std::auto_ptr<ErrorBox> box(
-                    new ErrorBox( currentCmdEnv->activeDialog(), WB_OK, msg ) 
);
-                if ( m_pDialogHelper )
-                    box->SetText( m_pDialogHelper->getWindow()->GetText() );
-                box->Execute();
+                vcl::solarthread::syncExecute(
+                    boost::bind( &solar_errorBox, m_pDialogHelper, msg, true ) 
);
                     //Continue with installation of the remaining extensions
             }
             {
diff --git 
a/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx 
b/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
index 56d00f3208..c58e4240d8 100644
--- a/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
+++ b/main/desktop/source/deployment/gui/dp_gui_handleversionexception.cxx
@@ -27,6 +27,8 @@
 #include "dp_gui_shared.hxx"
 #include "dp_gui.hrc"
 #include <vcl/msgbox.hxx>
+#include <vcl/threadex.hxx>
+#include <boost/bind.hpp>
 
 using namespace dp_gui;
 using namespace dp_misc;
@@ -44,6 +46,41 @@ OUString getVersion( const ::com::sun::star::uno::Reference< 
::com::sun::star::d
 {
     return getVersion( rPackage->getVersion());
 }
+
+bool solar_showVersionWarning(
+    DialogHelper * pDialogHelper, sal_uInt32 id, bool bEqualNames,
+    OUString const & rNewDisplayName, OUString const & rOldDisplayName,
+    OUString const & rNewVersion, OUString const & rDeployedVersion )
+{
+    vos::OGuard guard(Application::GetSolarMutex());
+    WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, 
ResId(id, *DeploymentGuiResMgr::get()));
+    String s;
+    if (bEqualNames)
+    {
+        s = box.GetMessText();
+    }
+    else if (id == RID_WARNINGBOX_VERSION_EQUAL)
+    {
+        //hypothetical: requires two instances of an extension with the same
+        //version to have different display names. Probably the developer 
forgot
+        //to change the version.
+        s = String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+    }
+    else if (id == RID_WARNINGBOX_VERSION_LESS)
+    {
+        s = String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+    }
+    else if (id == RID_WARNINGBOX_VERSION_GREATER)
+    {
+        s = String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
+    }
+    s.SearchAndReplaceAllAscii( "$NAME", rNewDisplayName);
+    s.SearchAndReplaceAllAscii( "$OLDNAME", rOldDisplayName);
+    s.SearchAndReplaceAllAscii( "$NEW", rNewVersion );
+    s.SearchAndReplaceAllAscii( "$DEPLOYED", rDeployedVersion );
+    box.SetMessText(s);
+    return box.Execute() == RET_OK;
+}
 }
 
 
@@ -82,36 +119,13 @@ bool handleVersionException(
     {
         const bool bEqualNames = verExc.NewDisplayName.equals(
             verExc.Deployed->getDisplayName());
-        {
-            vos::OGuard guard(Application::GetSolarMutex());
-            WarningBox box( pDialogHelper ? pDialogHelper->getWindow() : NULL, 
ResId(id, *DeploymentGuiResMgr::get()));
-            String s;
-            if (bEqualNames)
-            {
-                s = box.GetMessText();
-            }
-            else if (id == RID_WARNINGBOX_VERSION_EQUAL)
-            {
-                //hypothetical: requires two instances of an extension with 
the same
-                //version to have different display names. Probably the 
developer forgot
-                //to change the version.
-                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
-            }
-            else if (id == RID_WARNINGBOX_VERSION_LESS)
-            {
-                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
-            }
-            else if (id == RID_WARNINGBOX_VERSION_GREATER)
-            {
-                s = 
String(ResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES, 
*DeploymentGuiResMgr::get()));
-            }
-            s.SearchAndReplaceAllAscii( "$NAME", verExc.NewDisplayName);
-            s.SearchAndReplaceAllAscii( "$OLDNAME", 
verExc.Deployed->getDisplayName());
-            s.SearchAndReplaceAllAscii( "$NEW", getVersion(verExc.NewVersion) 
);
-            s.SearchAndReplaceAllAscii( "$DEPLOYED", 
getVersion(verExc.Deployed) );
-            box.SetMessText(s);
-            bApprove = box.Execute() == RET_OK;
-        }
+        // Reached from the deployment worker thread, where 
AquaSalInstance::Yield
+        // cannot pump the Cocoa event queue; the dialog must execute on the 
main
+        // thread or it appears but never receives events.
+        bApprove = vcl::solarthread::syncExecute(
+            boost::bind( &solar_showVersionWarning, pDialogHelper, id, 
bEqualNames,
+                         verExc.NewDisplayName, 
verExc.Deployed->getDisplayName(),
+                         getVersion(verExc.NewVersion), 
getVersion(verExc.Deployed) ) );
     }
 
     return bApprove;

Reply via email to