[Libreoffice-commits] core.git: include/vcl sd/source vcl/inc vcl/source
Noel Grandin
noel at peralex.com
Sat Sep 19 23:36:16 PDT 2015
include/vcl/svapp.hxx | 4 ++--
sd/source/ui/slideshow/slideshowimpl.cxx | 6 +++---
sd/source/ui/slideshow/slideshowimpl.hxx | 8 ++++----
vcl/inc/svdata.hxx | 7 ++++++-
vcl/source/app/svapp.cxx | 31 +++++++++++++++++++++++++------
5 files changed, 40 insertions(+), 16 deletions(-)
New commits:
commit 81e1e318bb47d4dc2f479ac1809d355c117f8ce8
Author: Noel Grandin <noel at peralex.com>
Date: Fri Sep 18 09:39:28 2015 +0200
convert Link<> to typed
Change-Id: If7fdd97d3c317a8e31641cc096c2c2639c1e012e
Reviewed-on: https://gerrit.libreoffice.org/18698
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 06079c6..1365215 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -596,7 +596,7 @@ public:
GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
EnableNoYieldMode, DisableNoYieldMode, RemovePostYieldListener
*/
- static void AddPostYieldListener( const Link<>& i_rListener );
+ static void AddPostYieldListener( const Link<LinkParamNone*,void>& i_rListener );
/** Remove listener for yield events
@@ -606,7 +606,7 @@ public:
GetMainThreadIdentifier, ReleaseSolarMutex, AcquireSolarMutex,
AddPostYieldListener, EnableNoYieldMode, DisableNoYieldMode
*/
- static void RemovePostYieldListener( const Link<>& i_rListener );
+ static void RemovePostYieldListener( const Link<LinkParamNone*,void>& i_rListener );
/** Queries whether the application is in "main", i.e. not yet in
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index d36cd09..25a0a1f 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1788,7 +1788,7 @@ IMPL_LINK_NOARG_TYPED(SlideshowImpl, updateHdl, Timer *, void)
updateSlideShow();
}
-IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener)
+IMPL_LINK_NOARG_TYPED(SlideshowImpl, PostYieldListener, LinkParamNone*, void)
{
// prevent me from deletion when recursing (App::Reschedule does)
const rtl::Reference<SlideshowImpl> this_(this);
@@ -1799,9 +1799,9 @@ IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener)
// *all* outstanding events after
// yield is done.
if (mbDisposed)
- return 0;
+ return;
Application::Reschedule(true);
- return updateSlideShow();
+ updateSlideShow();
}
sal_Int32 SlideshowImpl::updateSlideShow()
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index a7af283..06ac09e 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -274,13 +274,13 @@ private:
void setActiveXToolbarsVisible( bool bVisible );
- DECL_LINK_TYPED(updateHdl, Timer *, void);
- DECL_LINK( PostYieldListener, void* );
- DECL_LINK_TYPED(ReadyForNextInputHdl, Timer *, void);
+ DECL_LINK_TYPED( updateHdl, Timer *, void );
+ DECL_LINK_TYPED( PostYieldListener, LinkParamNone*, void );
+ DECL_LINK_TYPED( ReadyForNextInputHdl, Timer *, void );
DECL_LINK_TYPED( endPresentationHdl, void*, void );
DECL_LINK_TYPED( ContextMenuSelectHdl, Menu *, bool );
DECL_LINK_TYPED( ContextMenuHdl, void*, void );
- DECL_LINK_TYPED(deactivateHdl, Timer *, void);
+ DECL_LINK_TYPED( deactivateHdl, Timer *, void );
DECL_LINK( EventListenerHdl, VclSimpleEvent* );
// helper
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index e7496aa..91bd10f 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -104,6 +104,11 @@ public:
typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners;
+struct SVAppPostYieldListeners : public vcl::DeletionNotifier
+{
+ std::vector<Link<LinkParamNone*,void>> m_aListeners;
+};
+
struct ImplSVAppData
{
enum ImeStatusWindowMode
@@ -128,7 +133,7 @@ struct ImplSVAppData
VclPtr<ImplWheelWindow> mpWheelWindow; // WheelWindow
ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung
ImplEventHook* mpFirstEventHook; // Event-Hooks
- VclEventListeners2* mpPostYieldListeners; // post yield listeners
+ SVAppPostYieldListeners* mpPostYieldListeners; // post yield listeners
sal_uInt64 mnLastInputTime; // GetLastInputTime()
sal_uInt16 mnDispatchLevel; // DispatchLevel
sal_uInt16 mnModalMode; // ModalMode Count
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 2b5d8d7..c57ca13 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -377,7 +377,20 @@ inline void ImplYield(bool i_bWait, bool i_bAllEvents, sal_uLong const nReleased
// call post yield listeners
if( pSVData->maAppData.mpPostYieldListeners )
- pSVData->maAppData.mpPostYieldListeners->callListeners( NULL );
+ {
+ vcl::DeletionListener aDel( pSVData->maAppData.mpPostYieldListeners );
+
+ auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners;
+ // Copy the list, because this can be destroyed when calling a Link...
+ std::vector<Link<LinkParamNone*,void>> aCopy( rYieldListeners );
+ for( Link<LinkParamNone*,void>& rLink : aCopy )
+ {
+ if (aDel.isDeleted()) break;
+ // check this hasn't been removed in some re-enterancy scenario fdo#47368
+ if( std::find(rYieldListeners.begin(), rYieldListeners.end(), rLink) != rYieldListeners.end() )
+ rLink.Call( nullptr );
+ }
+ }
}
void Application::Reschedule( bool i_bAllEvents )
@@ -960,19 +973,25 @@ void Application::DisableNoYieldMode()
pSVData->maAppData.mbNoYield = false;
}
-void Application::AddPostYieldListener( const Link<>& i_rListener )
+void Application::AddPostYieldListener( const Link<LinkParamNone*,void>& i_rListener )
{
ImplSVData* pSVData = ImplGetSVData();
if( ! pSVData->maAppData.mpPostYieldListeners )
- pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2();
- pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener );
+ pSVData->maAppData.mpPostYieldListeners = new SVAppPostYieldListeners();
+ // ensure uniqueness
+ auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners;
+ if (std::find(rYieldListeners.begin(), rYieldListeners.end(), i_rListener) == rYieldListeners.end())
+ rYieldListeners.push_back( i_rListener );
}
-void Application::RemovePostYieldListener( const Link<>& i_rListener )
+void Application::RemovePostYieldListener( const Link<LinkParamNone*,void>& i_rListener )
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maAppData.mpPostYieldListeners )
- pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener );
+ {
+ auto& rYieldListeners = pSVData->maAppData.mpPostYieldListeners->m_aListeners;
+ rYieldListeners.erase( std::remove(rYieldListeners.begin(), rYieldListeners.end(), i_rListener ), rYieldListeners.end() );
+ }
}
WorkWindow* Application::GetAppWindow()
More information about the Libreoffice-commits
mailing list