diff --git a/tabbox/clientmodel.cpp b/tabbox/clientmodel.cpp index adeeca608d..9591babaa8 100644 --- a/tabbox/clientmodel.cpp +++ b/tabbox/clientmodel.cpp @@ -187,7 +187,7 @@ void ClientModel::createClientList(int desktop, bool partialReset) switch(tabBox->config().clientSwitchingMode()) { case TabBoxConfig::FocusChainSwitching: { - TabBoxClient* c = tabBox->nextClientFocusChain(start).data(); + TabBoxClient* c = start; if (!c) { QSharedPointer firstClient = tabBox->firstClientFocusChain().toStrongRef(); if (firstClient) { @@ -195,23 +195,16 @@ void ClientModel::createClientList(int desktop, bool partialReset) } } TabBoxClient* stop = c; - while (c) { + do { QWeakPointer add = tabBox->clientToAddToList(c, desktop); if (!add.isNull()) { - if (start == add.data()) { - m_clientList.removeAll(add); - m_clientList.prepend(add); - } else - m_clientList += add; + m_clientList += add; if (add.data()->isFirstInTabBox()) { stickyClients << add; } } c = tabBox->nextClientFocusChain(c).data(); - - if (c == stop) - break; - } + } while (c && c != stop); break; } case TabBoxConfig::StackingOrderSwitching: { diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index fda99da3f6..d96d0bdace 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -225,6 +225,9 @@ bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const QWeakPointer TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const { + if (!client) { + return QWeakPointer(); + } Client* ret = NULL; Client* current = (static_cast< TabBoxClientImpl* >(client))->client();