[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/io
From:       David Faure <faure () kde ! org>
Date:       2010-12-06 19:00:32
Message-ID: 20101206190032.96DE7AC8A5 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204319 by dfaure:

Fix debug output from klauncher-started apps being associated with debug area "kde" \
(the default component data name), due to kDebug() being used before the main \
component data is created (e.g. in kdeinit4's call to \
KStartupInfo::createNewStartupId).


 M  +9 -4      kdebug.cpp  


--- trunk/KDE/kdelibs/kdecore/io/kdebug.cpp #1204318:1204319
@@ -257,9 +257,9 @@
         Area &areaData = cache[0];
         areaData.clear();
 
-        //AB: this is necessary here, otherwise all output with area 0 won't be
-        //prefixed with anything, unless something with area != 0 is called before
+        Q_ASSERT(KGlobal::hasMainComponent());
         areaData.name = KGlobal::mainComponent().componentName().toUtf8();
+        //qDebug() << "loadAreaNames: area 0 has name" << \
KGlobal::mainComponent().componentName().toUtf8();  
         for (int i = 0; i < 8; i++) {
             m_nullOutputYesNoCache[i] = -1;
@@ -391,14 +391,18 @@
 
     Cache::Iterator areaData(QtMsgType type, unsigned int num, bool enableByDefault \
= true)  {
-        if (!configObject()) {
+        if (!configObject() || (cache.isEmpty() && !KGlobal::hasMainComponent())) {
             // we don't have a config and we can't create one...
+            // or we don't have a main component (yet?)
             Area &area = cache[0]; // create a dummy entry
+            if (KGlobal::hasMainComponent())
             area.name = KGlobal::mainComponent().componentName().toUtf8();
+            else
+                area.name = qApp ? qAppName().toUtf8() : QByteArray("unnamed app");
             return cache.find(0);
         }
 
-        if (!cache.contains(0)) {
+        if (!cache.contains(0) || (cache.count() == 1 && \
KGlobal::hasMainComponent())) {  loadAreaNames(); // fills 'cache'
         }
 
@@ -413,6 +417,7 @@
             static bool s_firstDebugFromApplication = true;
             if (s_firstDebugFromApplication && !m_disableAll) {
                 s_firstDebugFromApplication = false;
+                //qDebug() << "First debug output from" << it->name << "writing out \
with default" << enableByDefault;  writeGroupForNamedArea(it->name, enableByDefault);
             }
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic