Fix regressions related to stacking order changes

The change to have stacking order containing
Toplevel inestead of Clients (431aad6d6994695e72697fcc3299ec2cb6f0684e)
introduced possible crashers as recognized in:
http://git.reviewboard.kde.org/r/104519/#review12714

This change fixes these issues by adding missing
null pointer checks after casting to Client.

BUG: 298669
FIXED-IN: 4.9.0
REVIEW: 104714
icc-effect-5.14.5
Martin Gräßlin 2012-04-24 21:10:16 +02:00
parent 2fce451be5
commit 55980513e7
1 changed files with 4 additions and 4 deletions

View File

@ -418,9 +418,9 @@ void Workspace::restack(Client* c, Client* under)
assert(unconstrained_stacking_order.contains(under));
if (!Client::belongToSameApplication(under, c)) {
// put in the stacking order below _all_ windows belonging to the active application
Client *other = 0;
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) { // TODO ignore topmenus?
if (Client::belongToSameApplication(under, (other = qobject_cast<Client*>(unconstrained_stacking_order.at(i))))) {
for (int i = 0; i < unconstrained_stacking_order.size(); ++i) {
Client *other = qobject_cast<Client*>(unconstrained_stacking_order.at(i));
if (other && Client::belongToSameApplication(under, other)) {
under = (c == other) ? 0 : other;
break;
}
@ -767,7 +767,7 @@ void Client::restackWindow(Window above, int detail, NET::RequestSource src, Tim
}
Client *c = qobject_cast<Client*>(*it);
if (!( (*it)->isNormalWindow() && c->isShown(true) &&
if (!c || !( (*it)->isNormalWindow() && c->isShown(true) &&
(*it)->isOnCurrentDesktop() && (*it)->isOnCurrentActivity() && (*it)->isOnScreen(screen()) ))
continue; // irrelevant clients