From 22c75d86db9351ab271942a755a2a75a76920943 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 27 Jul 2016 20:55:45 +0200 Subject: 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 Reviewed-by: Michael Stahl --- sfx2/source/control/itemdel.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/control/itemdel.cxx b/sfx2/source/control/itemdel.cxx index d29f5fd4e703..1ac8ab8aa358 100644 --- a/sfx2/source/control/itemdel.cxx +++ b/sfx2/source/control/itemdel.cxx @@ -20,20 +20,17 @@ #include #include "itemdel.hxx" -#include -#include -#include -#include +#include #include class SfxItemDisruptor_Impl { SfxPoolItem * pItem; - Link 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; } -- cgit