Message: previous - next
Month: September 2012

"KDE4 is running"

From: Darrell Anderson <humanreadable@...>
Date: Wed, 5 Sep 2012 12:04:58 -0700 (PDT)
While tinkering with kdDebug I noticed the following message in my xsession log:

KDE4 is running

Um, nope, that would be incorrect. :)

The message is found in tdelibs/kded/kded.cpp:165-171:

TQString version = getenv( "KDE_SESSION_VERSION" );
TQStringList blacklist;
if ( version >= "4" )
    kdDebug(7020) << "KDE4 is running." << endl;
    blacklist << "mediamanager" << "medianotifier" << "kmilod" << "kwrited";

I'm no C++ coder but I believe the problem is 'version' is declared as a string but the test for the message is comparing a string to an integer. If I understand correctly, any non-zero value is treated as true. If KDE_SESSION_VERSION is empty then that value is not zero but null, which is a non-zero value?

Possibly the comparison test should change to:

if ( version != "" )

The KDE_SESSION_VERSION environment variable was introduced in KDE4 and did not exist in KDE3:

KDE_SESSION_VERSION will be set to some value only on a KDE4/5/6 system. Otherwise the getenv function returns null/empty. All we need determine is whether the variable is set to some value.