catch dangeling pointer in the desktopbutton hash

BUG: 244813

svn path=/trunk/KDE/kdebase/workspace/; revision=1187537
This commit is contained in:
Thomas Lübking 2010-10-19 18:34:19 +00:00
parent 1e9a63c3f4
commit 6356c736f8
2 changed files with 23 additions and 7 deletions

View file

@ -464,6 +464,20 @@ void DesktopGridEffect::windowClosed( EffectWindow* w )
effects->addRepaintFull();
}
void DesktopGridEffect::windowDeleted( EffectWindow* w )
{
for( QHash< DesktopButtonsView*, EffectWindow*>::iterator it = m_desktopButtonsViews.begin();
it != m_desktopButtonsViews.end(); ++it )
{
if( it.value() && it.value() == w )
{
it.key()->deleteLater();
m_desktopButtonsViews.erase( it );
break;
}
}
}
void DesktopGridEffect::windowGeometryShapeChanged( EffectWindow* w, const QRect& old )
{
Q_UNUSED( old )
@ -1325,14 +1339,15 @@ void DesktopGridEffect::finish()
}
m_proxy = 0;
}
while( !m_desktopButtonsViews.isEmpty() )
QHash< DesktopButtonsView*, EffectWindow* >::iterator i = m_desktopButtonsViews.begin();
while (i != m_desktopButtonsViews.end())
{
DesktopButtonsView* view = m_desktopButtonsViews.begin().key();
m_desktopButtonsViews[ view ]->unrefWindow();
m_desktopButtonsViews[ view ] = 0;
m_desktopButtonsViews.remove( view );
delete view;
view = 0;
if( *i && (*i)->isDeleted() )
(*i)->unrefWindow();
DesktopButtonsView *view = i.key();
i = m_desktopButtonsViews.erase(i);
view->deleteLater();
}
}

View file

@ -71,6 +71,7 @@ class DesktopGridEffect
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
virtual void paintWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
virtual void windowClosed( EffectWindow* w );
virtual void windowDeleted( EffectWindow* w );
virtual void windowAdded( EffectWindow* w );
virtual void windowGeometryShapeChanged( EffectWindow* w, const QRect& old );
virtual void windowInputMouseEvent( Window w, QEvent* e );