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

List:       kde-commits
Subject:    kdevelop/parts/cppsupport
From:       Roberto Raggi <roberto () kdevelop ! org>
Date:       2003-04-23 17:13:54
[Download RAW message or body]

CVS commit by raggi: 

fixed possible crash while obtaining text from an embedded text editor


  M +21 -4     backgroundparser.cpp   1.39


--- kdevelop/parts/cppsupport/backgroundparser.cpp  #1.38:1.39
@@ -18,4 +18,5 @@
 
 #include <kdevmutex.h>
+#include <kdevdeepcopy.h>
 
 #include <kparts/part.h>
@@ -164,5 +165,12 @@ public:
     virtual QString contents( const QString& fileName )
     {
-        //kapp->lock();
+        //kdDebug(9007) << "-------> kapp is locked = " << kapp->locked() << endl;
+        bool needToLock = kapp->locked() == false;
+
+        if( needToLock )
+            kapp->lock();
+
+        //kdDebug(9007) << "-------> kapp locked" << endl;
+
         QPtrList<KParts::Part> parts( *m_cppSupport->partController()->parts() );
         QPtrListIterator<KParts::Part> it( parts );
@@ -175,8 +183,17 @@ public:
                 continue;
 
-            QString contents = editIface->text();
-            return QString( contents.unicode(), contents.length() );
+            QString contents = QDeepCopy<QString>( editIface->text() );
+
+            if( needToLock )
+                kapp->unlock();
+
+            //kdDebug(9007) << "-------> kapp unlocked" << endl;
+
+            return contents;
         }
-        //kapp->unlock();
+
+        if( needToLock )
+            kapp->unlock();
+        //kdDebug(9007) << "-------> kapp unlocked" << endl;
 
         QFile f( fileName );


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

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