Merging from old trunk:

r613681 | lunakl | 2006-12-14 17:32:55 +0100 (Thu, 14 Dec 2006) | 4 lines

Check for references to no longer existing windows in transiency checks
only when the list of windows is in consistent state.


svn path=/trunk/KDE/kdebase/workspace/; revision=659481
This commit is contained in:
Luboš Luňák 2007-04-30 09:47:59 +00:00
parent 1f40973a83
commit b8ceefc820
4 changed files with 27 additions and 4 deletions

View file

@ -239,6 +239,7 @@ void Client::releaseWindow( bool on_shutdown )
del->unrefWindow(); del->unrefWindow();
deleteClient( this, Allowed ); deleteClient( this, Allowed );
ungrabXServer(); ungrabXServer();
checkNonExistentClients();
} }
// like releaseWindow(), but this one is called when the window has been already destroyed // like releaseWindow(), but this one is called when the window has been already destroyed
@ -277,6 +278,7 @@ void Client::destroyClient()
disownDataPassedToDeleted(); disownDataPassedToDeleted();
del->unrefWindow(); del->unrefWindow();
deleteClient( this, Allowed ); deleteClient( this, Allowed );
checkNonExistentClients();
} }
void Client::updateDecoration( bool check_workspace_pos, bool force ) void Client::updateDecoration( bool check_workspace_pos, bool force )

View file

@ -49,6 +49,8 @@ namespace KWin
#endif #endif
#ifdef ENABLE_TRANSIENCY_CHECK #ifdef ENABLE_TRANSIENCY_CHECK
static bool transiencyCheckNonExistent = false;
bool performTransiencyCheck() bool performTransiencyCheck()
{ {
bool ret = true; bool ret = true;
@ -74,7 +76,8 @@ bool performTransiencyCheck()
it2 != mains.end(); it2 != mains.end();
++it2 ) ++it2 )
{ {
if( !Workspace::self()->clients.contains( *it2 ) if( transiencyCheckNonExistent
&& !Workspace::self()->clients.contains( *it2 )
&& !Workspace::self()->desktops.contains( *it2 )) && !Workspace::self()->desktops.contains( *it2 ))
{ {
kDebug() << "TC:" << *it1 << " has non-existent main client " << endl; kDebug() << "TC:" << *it1 << " has non-existent main client " << endl;
@ -94,7 +97,8 @@ bool performTransiencyCheck()
it2 != trans.end(); it2 != trans.end();
++it2 ) ++it2 )
{ {
if( !Workspace::self()->clients.contains( *it2 ) if( transiencyCheckNonExistent
&& !Workspace::self()->clients.contains( *it2 )
&& !Workspace::self()->desktops.contains( *it2 )) && !Workspace::self()->desktops.contains( *it2 ))
{ {
kDebug() << "TC:" << *it1 << " has non-existent transient " << endl; kDebug() << "TC:" << *it1 << " has non-existent transient " << endl;
@ -115,13 +119,16 @@ bool performTransiencyCheck()
static QString transiencyCheckStartBt; static QString transiencyCheckStartBt;
static const Client* transiencyCheckClient; static const Client* transiencyCheckClient;
static int transiencyCheck = 0; static int transiencyCheck = 0;
static void startTransiencyCheck( const QString& bt, const Client* c )
static void startTransiencyCheck( const QString& bt, const Client* c, bool ne )
{ {
if( ++transiencyCheck == 1 ) if( ++transiencyCheck == 1 )
{ {
transiencyCheckStartBt = bt; transiencyCheckStartBt = bt;
transiencyCheckClient = c; transiencyCheckClient = c;
} }
if( ne )
transiencyCheckNonExistent = true;
} }
static void checkTransiency() static void checkTransiency()
{ {
@ -133,21 +140,32 @@ static void checkTransiency()
kdDebug() << "CLIENT:" << transiencyCheckClient << endl; kdDebug() << "CLIENT:" << transiencyCheckClient << endl;
assert( false ); assert( false );
} }
transiencyCheckNonExistent = false;
} }
} }
class TransiencyChecker class TransiencyChecker
{ {
public: public:
TransiencyChecker( const QString& bt, const Client*c ) { startTransiencyCheck( bt, c ); } TransiencyChecker( const QString& bt, const Client*c ) { startTransiencyCheck( bt, c, false ); }
~TransiencyChecker() { checkTransiency(); } ~TransiencyChecker() { checkTransiency(); }
}; };
void checkNonExistentClients()
{
startTransiencyCheck( kdBacktrace(), NULL, true );
checkTransiency();
}
#define TRANSIENCY_CHECK( c ) TransiencyChecker transiency_checker( kdBacktrace(), c ) #define TRANSIENCY_CHECK( c ) TransiencyChecker transiency_checker( kdBacktrace(), c )
#else #else
#define TRANSIENCY_CHECK( c ) #define TRANSIENCY_CHECK( c )
void checkNonExistentClients()
{
}
#endif #endif
//******************************************** //********************************************

View file

@ -325,6 +325,8 @@ int qtToX11State( Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers );
Qt::MouseButtons x11ToQtMouseButtons( int state ); Qt::MouseButtons x11ToQtMouseButtons( int state );
Qt::KeyboardModifiers x11ToQtKeyboardModifiers( int state ); Qt::KeyboardModifiers x11ToQtKeyboardModifiers( int state );
void checkNonExistentClients();
#ifndef KCMRULES #ifndef KCMRULES
// Qt dialogs emit no signal when closed :( // Qt dialogs emit no signal when closed :(

View file

@ -561,6 +561,7 @@ void Workspace::addClient( Client* c, allowed_t )
updateStackingOrder( true ); // propagate new client updateStackingOrder( true ); // propagate new client
if( c->isUtility() || c->isMenu() || c->isToolbar()) if( c->isUtility() || c->isMenu() || c->isToolbar())
updateToolWindows( true ); updateToolWindows( true );
checkNonExistentClients();
if( tab_grab ) if( tab_grab )
tab_box->reset( true ); tab_box->reset( true );
} }