[Libreoffice-commits] core.git: 4 commits - include/sfx2 include/svtools sfx2/source svtools/source vcl/qa vcl/source vcl/workben
Caolán McNamara
caolanm at redhat.com
Wed Oct 21 07:53:05 PDT 2015
dev/null |binary
include/sfx2/sidebar/ResourceManager.hxx | 1
include/sfx2/sidebar/SidebarController.hxx | 2
include/svtools/acceleratorexecute.hxx | 28 -----
sfx2/source/sidebar/ResourceManager.cxx | 9 +
sfx2/source/sidebar/SidebarController.cxx | 33 +-----
svtools/source/misc/acceleratorexecute.cxx | 95 +++++++++----------
vcl/qa/afl-eventtesting/README.eventtesting | 24 ++++
vcl/qa/afl-eventtesting/eventtesting.impress |binary
vcl/qa/afl-eventtesting/eventtesting.impress.crash-1 |binary
vcl/qa/afl-eventtesting/eventtesting.writer |binary
vcl/source/helper/evntpost.cxx | 1
vcl/workben/README.eventtesting | 24 ----
13 files changed, 86 insertions(+), 131 deletions(-)
New commits:
commit f80d42876af3808069ca5ea5fb758cf22777dbbc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 21 15:43:55 2015 +0100
drop unused stuff scheduled to be removed 'before the next major'
Change-Id: I2162618d430cf8dc6bb8d20d9a5dd9af543fa934
diff --git a/include/svtools/acceleratorexecute.hxx b/include/svtools/acceleratorexecute.hxx
index 975b44d..a4ef5d5 100644
--- a/include/svtools/acceleratorexecute.hxx
+++ b/include/svtools/acceleratorexecute.hxx
@@ -71,16 +71,6 @@ struct TMutexInit
*/
class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
{
-
- // const, types
- private:
-
- /** @deprecated
- replaced by internal class AsyncAccelExec ...
- remove this resource here if we go forwards to next major */
- typedef ::std::vector< ::std::pair< css::util::URL, css::uno::Reference< css::frame::XDispatch > > > TCommandQueue;
-
-
// member
private:
@@ -97,18 +87,6 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xGlobalCfg;
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xModuleCfg;
css::uno::Reference< css::ui::XAcceleratorConfiguration > m_xDocCfg;
-
- /** @deprecated
- replaced by internal class AsyncAccelExec ...
- remove this resource here if we go forwards to next major */
- TCommandQueue m_lCommandQueue;
-
- /** @deprecated
- replaced by internal class AsyncAccelExec ...
- remove this resource here if we go forwards to next major */
- vcl::EventPoster m_aAsyncCallback;
-
-
// interface
public:
@@ -227,12 +205,6 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
/** TODO document me */
SVT_DLLPRIVATE css::uno::Reference< css::util::XURLTransformer > impl_ts_getURLParser();
-
-
- /** @deprecated
- replaced by internal class AsyncAccelExec ...
- remove this resource here if we go forwards to next major */
- DECL_DLLPRIVATE_LINK_TYPED(impl_ts_asyncCallback, LinkParamNone*, void);
};
} // namespace svt
diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx
index a4e1ee5..0e77360 100644
--- a/svtools/source/misc/acceleratorexecute.cxx
+++ b/svtools/source/misc/acceleratorexecute.cxx
@@ -83,8 +83,7 @@ class SVT_DLLPRIVATE AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEv
AcceleratorExecute::AcceleratorExecute()
- : TMutexInit ( )
- , m_aAsyncCallback(LINK(this, AcceleratorExecute, impl_ts_asyncCallback))
+ : TMutexInit()
{
}
@@ -431,13 +430,6 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge
return xParser;
}
-
-IMPL_LINK_NOARG_TYPED(AcceleratorExecute, impl_ts_asyncCallback, LinkParamNone*, void)
-{
- // replaced by AsyncAccelExec!
-}
-
-
AsyncAccelExec::AsyncAccelExec(const css::uno::Reference<css::lang::XComponent>& xFrame,
const css::uno::Reference<css::frame::XDispatch>& xDispatch,
const css::util::URL& rURL)
commit 87179c89d55cad895336f14e9fdba11ea9694a15
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 21 14:24:00 2015 +0100
afl-eventtesting: crash when accelerator processed after frame is disposed
Change-Id: I8c3dcca53d5fb18e9f1da0499a071d35a859a9de
diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx
index f5aacd0..a4e1ee5 100644
--- a/svtools/source/misc/acceleratorexecute.cxx
+++ b/svtools/source/misc/acceleratorexecute.cxx
@@ -33,19 +33,22 @@
#include <com/sun/star/util/URLTransformer.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/implbase.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
-
namespace svt
{
-
-
-class SVT_DLLPRIVATE AsyncAccelExec
+class SVT_DLLPRIVATE AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEventListener>
{
+ private:
+ css::uno::Reference<css::lang::XComponent> m_xFrame;
+ css::uno::Reference< css::frame::XDispatch > m_xDispatch;
+ css::util::URL m_aURL;
+ vcl::EventPoster m_aAsyncCallback;
public:
/** creates a new instance of this class, which can be used
@@ -54,25 +57,28 @@ class SVT_DLLPRIVATE AsyncAccelExec
This instance can be forced to execute it's internal set request
asynchronous. After that it deletes itself !
*/
- static AsyncAccelExec* createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
- const css::util::URL& aURL );
+ static AsyncAccelExec* createOnShotInstance(const css::uno::Reference<css::lang::XComponent>& xFrame,
+ const css::uno::Reference<css::frame::XDispatch>& xDispatch,
+ const css::util::URL& rURL);
void execAsync();
-
private:
+ virtual void SAL_CALL disposing(const css::lang::EventObject&) throw (css::uno::RuntimeException, std::exception) override
+ {
+ m_xFrame->removeEventListener(this);
+ m_xFrame.clear();
+ m_xDispatch.clear();
+ }
+
/** @short allow creation of instances of this class
by using our factory only!
*/
- SVT_DLLPRIVATE AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
- const css::util::URL& aURL );
+ SVT_DLLPRIVATE AsyncAccelExec(const css::uno::Reference<css::lang::XComponent>& xFrame,
+ const css::uno::Reference< css::frame::XDispatch >& xDispatch,
+ const css::util::URL& rURL);
DECL_DLLPRIVATE_LINK_TYPED(impl_ts_asyncCallback, LinkParamNone*, void);
-
- private:
- vcl::EventPoster m_aAsyncCallback;
- css::uno::Reference< css::frame::XDispatch > m_xDispatch;
- css::util::URL m_aURL;
};
@@ -197,7 +203,8 @@ bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey)
if ( bRet )
{
// Note: Such instance can be used one times only and destroy itself afterwards .-)
- AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xDispatch, aURL);
+ css::uno::Reference<css::lang::XComponent> xFrame(xProvider, css::uno::UNO_QUERY);
+ AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xFrame, xDispatch, aURL);
pExec->execAsync();
}
@@ -431,46 +438,48 @@ IMPL_LINK_NOARG_TYPED(AcceleratorExecute, impl_ts_asyncCallback, LinkParamNone*,
}
-AsyncAccelExec::AsyncAccelExec(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
- const css::util::URL& aURL )
- : m_aAsyncCallback(LINK(this, AsyncAccelExec, impl_ts_asyncCallback))
- , m_xDispatch (xDispatch )
- , m_aURL (aURL )
+AsyncAccelExec::AsyncAccelExec(const css::uno::Reference<css::lang::XComponent>& xFrame,
+ const css::uno::Reference<css::frame::XDispatch>& xDispatch,
+ const css::util::URL& rURL)
+ : m_xFrame(xFrame)
+ , m_xDispatch(xDispatch)
+ , m_aURL(rURL)
+ , m_aAsyncCallback(LINK(this, AsyncAccelExec, impl_ts_asyncCallback))
{
}
-
-AsyncAccelExec* AsyncAccelExec::createOnShotInstance(const css::uno::Reference< css::frame::XDispatch >& xDispatch,
- const css::util::URL& aURL )
+AsyncAccelExec* AsyncAccelExec::createOnShotInstance(const css::uno::Reference<css::lang::XComponent> &xFrame,
+ const css::uno::Reference< css::frame::XDispatch >& xDispatch,
+ const css::util::URL& rURL)
{
- AsyncAccelExec* pExec = new AsyncAccelExec(xDispatch, aURL);
+ AsyncAccelExec* pExec = new AsyncAccelExec(xFrame, xDispatch, rURL);
return pExec;
}
void AsyncAccelExec::execAsync()
{
+ acquire();
+ if (m_xFrame.is())
+ m_xFrame->addEventListener(this);
m_aAsyncCallback.Post();
}
-
IMPL_LINK_NOARG_TYPED(AsyncAccelExec, impl_ts_asyncCallback, LinkParamNone*, void)
{
- if (! m_xDispatch.is())
- return;
-
- try
+ if (m_xDispatch.is())
{
- m_xDispatch->dispatch(m_aURL, css::uno::Sequence< css::beans::PropertyValue >());
+ try
+ {
+ if (m_xFrame.is())
+ m_xFrame->removeEventListener(this);
+ m_xDispatch->dispatch(m_aURL, css::uno::Sequence< css::beans::PropertyValue >());
+ }
+ catch(const css::uno::Exception&)
+ {
+ }
}
- catch(const css::lang::DisposedException&)
- {}
- catch(const css::uno::RuntimeException& )
- { throw; }
- catch(const css::uno::Exception&)
- {}
-
- delete this;
+ release();
}
} // namespace svt
diff --git a/vcl/qa/afl-eventtesting/eventtesting.impress.crash-1 b/vcl/qa/afl-eventtesting/eventtesting.impress.crash-1
new file mode 100644
index 0000000..f8802b5
Binary files /dev/null and b/vcl/qa/afl-eventtesting/eventtesting.impress.crash-1 differ
commit e86effd159d06a6ceeb5571f98d4f45c7fe9f893
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 21 14:19:37 2015 +0100
move afl examples/test-cases to dedicated dir
Change-Id: I36f09cd19ea721ee69e62fac4cf0744827e8cefb
diff --git a/vcl/workben/README.eventtesting b/vcl/qa/afl-eventtesting/README.eventtesting
similarity index 100%
rename from vcl/workben/README.eventtesting
rename to vcl/qa/afl-eventtesting/README.eventtesting
diff --git a/vcl/workben/eventtesting.impress b/vcl/qa/afl-eventtesting/eventtesting.impress
similarity index 100%
rename from vcl/workben/eventtesting.impress
rename to vcl/qa/afl-eventtesting/eventtesting.impress
diff --git a/vcl/workben/eventtesting.writer b/vcl/qa/afl-eventtesting/eventtesting.writer
similarity index 100%
rename from vcl/workben/eventtesting.writer
rename to vcl/qa/afl-eventtesting/eventtesting.writer
diff --git a/vcl/source/helper/evntpost.cxx b/vcl/source/helper/evntpost.cxx
index 5331eca..abc9bbb 100644
--- a/vcl/source/helper/evntpost.cxx
+++ b/vcl/source/helper/evntpost.cxx
@@ -40,7 +40,6 @@ EventPoster::~EventPoster()
}
void EventPoster::Post()
-
{
DBG_TESTSOLARMUTEX();
m_nId = Application::PostUserEvent( ( LINK( this, EventPoster, DoEvent_Impl ) ) );
commit 3303f43a6ea3c377331491d70a539e7e02ca9df8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 21 10:45:07 2015 +0100
afl-eventtesting + VclPtr: only current context decks getting disposed
but they all have to go, not just the current one
Change-Id: I84819c2a74042ad028fbdd8acba5d925c7fdedab
diff --git a/include/sfx2/sidebar/ResourceManager.hxx b/include/sfx2/sidebar/ResourceManager.hxx
index 275737d..bd69b9e 100644
--- a/include/sfx2/sidebar/ResourceManager.hxx
+++ b/include/sfx2/sidebar/ResourceManager.hxx
@@ -67,6 +67,7 @@ public:
void UpdateModel(css::uno::Reference<css::frame::XModel> xModel);
+ void disposeDecks();
class DeckContextDescriptor
{
diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx
index b90f037..1774fe1 100644
--- a/include/sfx2/sidebar/SidebarController.hxx
+++ b/include/sfx2/sidebar/SidebarController.hxx
@@ -160,7 +160,7 @@ public:
void updateModel(css::uno::Reference<css::frame::XModel> xModel);
- void disposeDecks(css::uno::Reference<css::frame::XController> xController);
+ void disposeDecks();
private:
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index d3d4750..243f4a6 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -649,7 +649,8 @@ bool ResourceManager::IsDeckEnabled (
void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel)
{
- for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr) {
+ for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+ {
if (!itr->mpDeck)
continue;
@@ -661,8 +662,12 @@ void ResourceManager::UpdateModel(css::uno::Reference<css::frame::XModel> xModel
}
}
+}
-
+void ResourceManager::disposeDecks()
+{
+ for (DeckContainer::iterator itr = maDecks.begin(); itr != maDecks.end(); ++itr)
+ itr->mpDeck.disposeAndClear();
}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 896b06d..1d88286 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -174,7 +174,7 @@ void SidebarController::registerSidebarForFrame(SidebarController* pController,
void SidebarController::unregisterSidebarForFrame(SidebarController* pController, css::uno::Reference<css::frame::XController> xController)
{
- pController->disposeDecks(xController);
+ pController->disposeDecks();
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
css::ui::ContextChangeEventMultiplexer::get(
::comphelper::getProcessComponentContext()));
@@ -184,34 +184,11 @@ void SidebarController::unregisterSidebarForFrame(SidebarController* pController
xController);
}
-void SidebarController::disposeDecks(css::uno::Reference<css::frame::XController> xController)
+void SidebarController::disposeDecks()
{
- // clear decks
- ResourceManager::DeckContextDescriptorContainer aDecks;
-
- mpResourceManager->GetMatchingDecks (
- aDecks,
- GetCurrentContext(),
- IsDocumentReadOnly(),
- xController);
-
- for (ResourceManager::DeckContextDescriptorContainer::const_iterator
- iDeck(aDecks.begin()), iEnd(aDecks.end());
- iDeck!=iEnd; ++iDeck)
- {
- const DeckDescriptor* deckDesc = mpResourceManager->GetDeckDescriptor(iDeck->msId);
- VclPtr<Deck> aDeck = deckDesc->mpDeck;
- if (aDeck == mpCurrentDeck)
- {
- mpCurrentDeck.clear();
- maFocusManager.Clear();
- }
- if (aDeck)
- {
- aDeck.disposeAndClear();
- mpResourceManager->SetDeckToDescriptor(iDeck->msId, VclPtr<Deck>());
- }
- }
+ mpCurrentDeck.clear();
+ maFocusManager.Clear();
+ mpResourceManager->disposeDecks();
}
void SAL_CALL SidebarController::disposing()
More information about the Libreoffice-commits
mailing list