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

List:       kde-commits
Subject:    kdeextragear-1/amarok/src/amarokcore
From:       Max Howell <max.howell () methylblue ! com>
Date:       2005-03-10 0:10:49
Message-ID: 20050310001049.07CFD10B25 () office ! kde ! org
[Download RAW message or body]

CVS commit by mhowell: 

Improve the crashhandler. Please review as I couldn't simulate a crash for some \
reason, my usual method (insert a null pointer dereference) wouldn't work - amaroK \
just vanished. If you know regexp your review is most appreciated :) The problem \
before was the invalid crash frame count included the valid frames too.

CCMAIL:amarok-devel@lists.sf.net


  M +10 -5     crashhandler.cpp   1.19


--- kdeextragear-1/amarok/src/amarokcore/crashhandler.cpp  #1.18:1.19
@@ -129,4 +129,6 @@ namespace amaroK
             /// clean up
             bt.remove( "(no debugging symbols found)..." );
+            bt.remove( "(no debugging symbols found)\n" );
+            bt.replace( QRegExp("\n{2,}"), "\n" ); //clean up multiple \n characters
             bt.stripWhiteSpace();
 
@@ -135,13 +137,16 @@ namespace amaroK
 
             if( fileCommandOutput.find( "not stripped", false ) == -1 )
-                subject += "[stripped]";
+                subject += "[___stripped]"; //same length as below
+            else
+                subject += "[NOTstripped]";
 
             if( !bt.isEmpty() ) {
-                const int invalidFrames = bt.contains( \
                QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ \\w* \\?\\?") );
-                const int validFrames = bt.contains( \
QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+") ); +                const int invalidFrames = \
bt.contains( QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in \\?\\?") ); +                \
const int validFrames = bt.contains( QRegExp("\n#[0-9]+\\s+0x[0-9A-Fa-f]+ in [^?]") \
);  const int totalFrames = invalidFrames + validFrames;
 
+                if( totalFrames > 0 )
                 subject += QString("[validity: %1]").arg( double(validFrames) / \
                totalFrames, 0, 'f', 2 );
-                subject += QString("[frames: %1]").arg( totalFrames );
+                subject += QString("[frames: %1]").arg( totalFrames, 3 /*padding*/ \
);  
                 if( bt.find( QRegExp(" at \\w*\\.cpp:\\d+\n") ) >= 0 )


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

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