Avoid infinite loop with empty caption.

CCMAIL: jowenn@kde.org
This should fix your problem, can you try again?

svn path=/trunk/kdebase/kwin/; revision=259094
icc-effect-5.14.5
Luboš Luňák 2003-10-15 09:48:22 +00:00
parent 170cdee841
commit 5af892be88
1 changed files with 5 additions and 6 deletions

View File

@ -1158,7 +1158,7 @@ void Client::showContextHelp()
Fetches the window's caption (WM_NAME property). It will be Fetches the window's caption (WM_NAME property). It will be
stored in the client's caption(). stored in the client's caption().
*/ */
KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, QString, cl->cap_normal + cl->cap_suffix == value ); KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, const Client*, cl != value && cl->caption() == value->caption());
void Client::fetchName() void Client::fetchName()
{ {
@ -1170,20 +1170,19 @@ void Client::fetchName()
s = KWin::readNameProperty( window(), XA_WM_NAME ); s = KWin::readNameProperty( window(), XA_WM_NAME );
if ( s != cap_normal ) if ( s != cap_normal )
{ {
cap_normal = ""; cap_normal = s;
bool was_suffix = ( !cap_suffix.isEmpty()); bool was_suffix = ( !cap_suffix.isEmpty());
cap_suffix = QString::null; cap_suffix = QString::null;
if ( workspace()->findClient( FetchNameInternalPredicate( s ))) if ( workspace()->findClient( FetchNameInternalPredicate( this )))
{ {
int i = 2; int i = 2;
do do
{ {
cap_suffix = " <" + QString::number(i) + ">"; cap_suffix = " <" + QString::number(i) + ">";
i++; i++;
} while ( workspace()->findClient( FetchNameInternalPredicate( s + cap_suffix ))); } while ( workspace()->findClient( FetchNameInternalPredicate( this )));
info->setVisibleName( ( s + cap_suffix ).utf8() ); info->setVisibleName( caption().utf8() );
} }
cap_normal = s;
if( was_suffix && cap_suffix.isEmpty()) if( was_suffix && cap_suffix.isEmpty())
{ {
info->setVisibleName( "" ); // remove info->setVisibleName( "" ); // remove