always defer delete of Deleted to next event cycle

BUG: 317765
FIXED-IN: 4.11
REVIEW: 110756
This commit is contained in:
Thomas Lübking 2013-05-31 19:15:51 +02:00
parent abaf6faae1
commit b8439145bd
3 changed files with 8 additions and 9 deletions

View file

@ -107,16 +107,15 @@ void Deleted::copyToDeleted(Toplevel* c)
}
}
void Deleted::unrefWindow(bool delay)
void Deleted::unrefWindow()
{
if (--delete_refcount > 0)
return;
// needs to be delayed when calling from effects, otherwise it'd be rather
// complicated to handle the case of the window going away during a painting pass
if (delay)
deleteLater();
else
delete this;
// needs to be delayed
// a) when calling from effects, otherwise it'd be rather complicated to handle the case of the
// window going away during a painting pass
// b) to prevent dangeling pointers in the stacking order, see bug #317765
deleteLater();
}
int Deleted::desktop() const

View file

@ -37,7 +37,7 @@ public:
static Deleted* create(Toplevel* c);
// used by effects to keep the window around for e.g. fadeout effects when it's destroyed
void refWindow();
void unrefWindow(bool delay = false);
void unrefWindow();
void discard();
virtual int desktop() const;
virtual QStringList activities() const;

View file

@ -1662,7 +1662,7 @@ void EffectWindowImpl::refWindow()
void EffectWindowImpl::unrefWindow()
{
if (Deleted* d = dynamic_cast< Deleted* >(toplevel))
return d->unrefWindow(true); // delayed
return d->unrefWindow(); // delays deletion in case
abort(); // TODO
}