[Libreoffice-commits] core.git: sfx2/source

Michael Stahl mstahl at redhat.com
Thu Jul 28 09:04:48 UTC 2016


 sfx2/source/control/itemdel.cxx |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 22c75d86db9351ab271942a755a2a75a76920943
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jul 27 20:55:45 2016 +0200

    sfx2: just use Idle in SfxItemDisruptor_Impl
    
    This Application::InsertIdleHdl() stuff is ancient and now obsolete.
    
    Change-Id: I082870328711b2159b05d8cb077c0e439b7ee94c
    Reviewed-on: https://gerrit.libreoffice.org/27597
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sfx2/source/control/itemdel.cxx b/sfx2/source/control/itemdel.cxx
index d29f5fd..1ac8ab8 100644
--- a/sfx2/source/control/itemdel.cxx
+++ b/sfx2/source/control/itemdel.cxx
@@ -20,20 +20,17 @@
 #include <sal/config.h>
 
 #include "itemdel.hxx"
-#include <vcl/svapp.hxx>
-#include <tools/errcode.hxx>
-#include <limits.h>
-#include <vector>
+#include <vcl/idle.hxx>
 
 #include <svl/itempool.hxx>
 
 class SfxItemDisruptor_Impl
 {
     SfxPoolItem *           pItem;
-    Link<Application*,void> aLink;
+    Idle m_Idle;
 
 private:
-    DECL_LINK_TYPED( Delete, Application*, void );
+    DECL_LINK_TYPED( Delete, Idle*, void );
 
 public:
     explicit SfxItemDisruptor_Impl(SfxPoolItem *pItemToDesrupt);
@@ -43,10 +40,12 @@ public:
     SfxItemDisruptor_Impl& operator=(const SfxItemDisruptor_Impl&) = delete;
 };
 
-SfxItemDisruptor_Impl::SfxItemDisruptor_Impl( SfxPoolItem *pItemToDesrupt ):
-    pItem(pItemToDesrupt),
-    aLink( LINK(this, SfxItemDisruptor_Impl, Delete) )
+SfxItemDisruptor_Impl::SfxItemDisruptor_Impl(SfxPoolItem *const pItemToDisrupt)
+    : pItem(pItemToDisrupt)
+    , m_Idle("SfxItemDisruptor_Impl")
 {
+    m_Idle.SetIdleHdl(LINK(this, SfxItemDisruptor_Impl, Delete));
+    m_Idle.SetPriority(SchedulerPriority::DEFAULT_IDLE);
 
     DBG_ASSERT( 0 == pItem->GetRefCount(), "disrupting pooled item" );
     pItem->SetKind( SFX_ITEMS_DELETEONIDLE );
@@ -54,15 +53,12 @@ SfxItemDisruptor_Impl::SfxItemDisruptor_Impl( SfxPoolItem *pItemToDesrupt ):
 
 void SfxItemDisruptor_Impl::LaunchDeleteOnIdle()
 {
-    // process in Idle
-    Application::InsertIdleHdl( aLink, 1 );
+    m_Idle.Start();
 }
 
 SfxItemDisruptor_Impl::~SfxItemDisruptor_Impl()
 {
-
-    // remove from Idle-Handler
-    Application::RemoveIdleHdl( aLink );
+    m_Idle.Stop();
 
     // reset RefCount (was set to SFX_ITEMS_SPECIAL before!)
     pItem->SetRefCount( 0 );
@@ -70,7 +66,7 @@ SfxItemDisruptor_Impl::~SfxItemDisruptor_Impl()
     delete pItem;
 }
 
-IMPL_LINK_NOARG_TYPED(SfxItemDisruptor_Impl, Delete, Application*, void)
+IMPL_LINK_NOARG_TYPED(SfxItemDisruptor_Impl, Delete, Idle*, void)
 {
     delete this;
 }


More information about the Libreoffice-commits mailing list