diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-08 11:20:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-08 12:14:54 +0100 |
commit | b2c6c91391f01faa287de18e59e4762031ef6ddc (patch) | |
tree | dae1959b7f9d9c99f946bbfba3dc981ae76de0a4 /desktop | |
parent | LinkParamNone can be complete but uninstantiatable (diff) | |
download | core-b2c6c91391f01faa287de18e59e4762031ef6ddc.tar.gz core-b2c6c91391f01faa287de18e59e4762031ef6ddc.zip |
Related: rhbz#100713 move extensions restart to a better place
move it to when the dialog is closed rather than trying to
launch it as soon as any modifications take place because
those are happening during threaded code and the restart
is always cancelled by the dialog itself leading to repeated
restart dialogs
Now at least it doesn't crash, but if we open an oxt on the command
line, a restart will reopen it, which is probably not what we want.
Maybe this restart on an extension modification is a bad idea in
the first place.
Change-Id: Ib7d6179e6703ed3353fce44c3e54f5be1c1dfa68
Diffstat (limited to 'desktop')
5 files changed, 26 insertions, 9 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index b14650ac1ab8..bd8d222a9d05 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -43,6 +43,7 @@ #include <osl/mutex.hxx> #include <svtools/extensionlistbox.hxx> +#include <svtools/restartdialog.hxx> #include <sfx2/sfxdlg.hxx> @@ -670,6 +671,7 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, , m_bEnableWarning(false) , m_bDisableWarning(false) , m_bDeleteWarning(false) + , m_bClosed(false) , m_nProgress(0) , m_pManager(pManager) { @@ -1146,6 +1148,12 @@ bool ExtMgrDialog::Notify( NotifyEvent& rNEvt ) return true; } +IMPL_LINK_NOARG_TYPED(ExtMgrDialog, Restart, void*, void) +{ + SolarMutexGuard aGuard; + ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), + nullptr, svtools::RESTART_REASON_EXTENSION_INSTALL); +} bool ExtMgrDialog::Close() { @@ -1154,6 +1162,13 @@ bool ExtMgrDialog::Close() { bRet = ModelessDialog::Close(); m_pManager->terminateDialog(); + //only suggest restart if modified and this is the first close attempt + if (!m_bClosed && m_pManager->isModified()) + { + m_pManager->clearModified(); + Application::PostUserEvent(LINK(nullptr, ExtMgrDialog, Restart)); + } + m_bClosed = true; } return bRet; } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 82616dd21f1b..4012cfcafaea 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -123,6 +123,7 @@ class ExtMgrDialog : public ModelessDialog, bool m_bEnableWarning; bool m_bDisableWarning; bool m_bDeleteWarning; + bool m_bClosed; long m_nProgress; Idle m_aIdle; TheExtensionManager *m_pManager; @@ -139,6 +140,7 @@ class ExtMgrDialog : public ModelessDialog, DECL_DLLPRIVATE_LINK_TYPED( HandleHyperlink, FixedHyperlink&, void ); DECL_DLLPRIVATE_LINK_TYPED(TimeOutHdl, Idle *, void); DECL_DLLPRIVATE_LINK_TYPED( startProgress, void *, void ); + DECL_DLLPRIVATE_LINK_TYPED( Restart, void *, void ); public: ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 1f30767cf419..3b1f0cb6dbc3 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -54,7 +54,8 @@ TheExtensionManager::TheExtensionManager( const uno::Reference< awt::XWindow > & m_xParent( xParent ), m_pExtMgrDialog( nullptr ), m_pUpdReqDialog( nullptr ), - m_pExecuteCmdQueue( nullptr ) + m_pExecuteCmdQueue( nullptr ), + m_bModified(false) { m_xExtensionManager = deployment::ExtensionManager::get( xContext ); m_xExtensionManager->addModifyListener( this ); @@ -468,6 +469,7 @@ void TheExtensionManager::notifyTermination( ::lang::EventObject const & rEvt ) void TheExtensionManager::modified( ::lang::EventObject const & /*rEvt*/ ) throw ( uno::RuntimeException, std::exception ) { + m_bModified = true; getDialogHelper()->prepareChecking(); createPackageList(); getDialogHelper()->checkEntries(); diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 756c0e9303fa..6d7436cfb5e6 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -58,6 +58,7 @@ private: ExtensionCmdQueue *m_pExecuteCmdQueue; OUString m_sGetExtensionsURL; + bool m_bModified; public: static ::rtl::Reference<TheExtensionManager> s_ExtMgr; @@ -69,6 +70,9 @@ public: void createDialog( const bool bCreateUpdDlg ); sal_Int16 execute(); + bool isModified() const { return m_bModified; } + void clearModified() { m_bModified = false; } + Dialog* getDialog() { if (m_pExtMgrDialog) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index c3e48071f3d1..b98cc0ee95ea 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -44,7 +44,6 @@ #include <comphelper/sequence.hxx> #include <xmlscript/xml_helper.hxx> #include <osl/diagnose.h> -#include <svtools/restartdialog.hxx> #include <vcl/svapp.hxx> #include "dp_interact.h" #include "dp_resource.h" @@ -160,11 +159,10 @@ ExtensionRemoveGuard::~ExtensionRemoveGuard() namespace dp_manager { - //ToDo: bundled extension ExtensionManager::ExtensionManager( Reference< uno::XComponentContext > const& xContext) : - ::cppu::WeakComponentImplHelper< css::deployment::XExtensionManager >(getMutex()), - m_xContext( xContext ) + ::cppu::WeakComponentImplHelper< css::deployment::XExtensionManager >(getMutex()) + , m_xContext(xContext) { m_xPackageManagerFactory = css::deployment::thePackageManagerFactory::get(m_xContext); OSL_ASSERT(m_xPackageManagerFactory.is()); @@ -174,7 +172,6 @@ ExtensionManager::ExtensionManager( Reference< uno::XComponentContext > const& x m_repositoryNames.push_back("bundled"); } - ExtensionManager::~ExtensionManager() { } @@ -1496,9 +1493,6 @@ void ExtensionManager::fireModified() [this] (uno::Reference<util::XModifyListener> const& xListener) { return xListener->modified(lang::EventObject(static_cast<OWeakObject *>(this))); }); } - - SolarMutexGuard aGuard; - ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_EXTENSION_INSTALL); } } // namespace dp_manager |