diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-25 22:15:09 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-26 13:34:05 +0200 |
commit | 6b50f11fafad9b934bef24259ebf90fbfb1d0a30 (patch) | |
tree | 10fc89c1e2fb6eda30753adfa51da03ddc034239 /vcl | |
parent | f6c0803e9984e716f5ba86a0271ecad7e0ed61d8 (diff) |
fix nasty memory leak on shutdown
This makes the output of Lsan so much more useful.
Change-Id: I6c7624d4f6f767454c125c00ce037f5d2ec3cd61
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/idlemgr.hxx | 1 | ||||
-rw-r--r-- | vcl/source/app/idlemgr.cxx | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/vcl/inc/idlemgr.hxx b/vcl/inc/idlemgr.hxx index 02fc85ec0985..4e0a6396b8cf 100644 --- a/vcl/inc/idlemgr.hxx +++ b/vcl/inc/idlemgr.hxx @@ -31,6 +31,7 @@ class ImplIdleMgr private: ImplIdleList* mpIdleList; AutoTimer maTimer; + bool mbInDestruction; public: ImplIdleMgr(); diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx index cd41d1260caa..fbbd14159ec1 100644 --- a/vcl/source/app/idlemgr.cxx +++ b/vcl/source/app/idlemgr.cxx @@ -30,7 +30,8 @@ struct ImplIdleData #define IMPL_IDLETIMEOUT 350 -ImplIdleMgr::ImplIdleMgr() +ImplIdleMgr::ImplIdleMgr(): + mbInDestruction(false) { mpIdleList = new ImplIdleList(); @@ -40,9 +41,12 @@ ImplIdleMgr::ImplIdleMgr() ImplIdleMgr::~ImplIdleMgr() { + mbInDestruction = true; // Liste loeschen for ( size_t i = 0, n = mpIdleList->size(); i < n; ++i ) { - delete (*mpIdleList)[ i ]; + ImplIdleData* pIdleData = (*mpIdleList)[ i ]; + pIdleData->maIdleHdl.Call( GetpApp() ); + delete pIdleData; } mpIdleList->clear(); delete mpIdleList; @@ -84,6 +88,9 @@ bool ImplIdleMgr::InsertIdleHdl( const Link& rLink, sal_uInt16 nPriority ) void ImplIdleMgr::RemoveIdleHdl( const Link& rLink ) { + if (mbInDestruction) + return; + for ( ImplIdleList::iterator it = mpIdleList->begin(); it != mpIdleList->end(); ++it ) { if ( (*it)->maIdleHdl == rLink ) { delete *it; |