Kaydet (Commit) 6b50f11f authored tarafından Markus Mohrhard's avatar Markus Mohrhard

fix nasty memory leak on shutdown

This makes the output of Lsan so much more useful.

Change-Id: I6c7624d4f6f767454c125c00ce037f5d2ec3cd61
üst f6c0803e
......@@ -31,6 +31,7 @@ class ImplIdleMgr
private:
ImplIdleList* mpIdleList;
AutoTimer maTimer;
bool mbInDestruction;
public:
ImplIdleMgr();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment