[Uml-devel] branches/KDE/3.5/kdesdk/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Feb 15 22:46:00 UTC 2006


SVN commit 510038 by okellogg:

Hot fix for PythonImport crash; there are still plenty of rough spots in the
Python import and it needs more work. Patches and contributions are welcome.
BUG:121952


 M  +2 -2      ChangeLog  
 M  +4 -3      umbrello/nativeimportbase.cpp  
 M  +10 -1     umbrello/pythonimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #510037:510038
@@ -9,9 +9,9 @@
 * Multiplicity labels positioned incorrectly when moving entities (120598)
 * Types of entity's attributes are displayed instead of their names (120742)
 * Unable to delete entity from entity list in "UML Model" frame (120750)
-* Unable to delete entity from entity list in "UML Model" frame (120750)
-* Changing font style has no effect on classes (120761)
+* Interface names not italicized in diagram view (120761)
 * Cannot Resize Sequence Diagram Synchronous Messages (120910)
+* Crash when importing Python files (121952)
 
 Version 1.5.1
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/nativeimportbase.cpp #510037:510038
@@ -49,9 +49,10 @@
         else
             break;
     }
-    if (m_srcIndex ==  m_source.count() - 1 &&
-            m_source[m_srcIndex].startsWith(m_singleLineCommentIntro)) {
-        // last item in m_source is a comment
+    if (m_srcIndex >= m_source.count() - 1 ||
+        // if last item in m_source is a comment then it is dropped too
+        (m_srcIndex == m_source.count() - 1 &&
+         m_source[m_srcIndex].startsWith(m_singleLineCommentIntro))) {
         return QString::null;
     }
     return m_source[m_srcIndex];
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/pythonimport.cpp #510037:510038
@@ -53,6 +53,7 @@
             m_comment += text.stripWhiteSpace();
         }
         m_source.append(m_singleLineCommentIntro + m_comment);  // denotes comments in `m_source'
+        m_srcIndex++;
         m_comment = "";
         m_inComment = false;
         pos += 3;  // pos now points behind the closed comment
@@ -78,8 +79,10 @@
             if (endpos > pos + 3)  {
                 QString cmnt = line.mid(pos + 3, endpos - pos - 3);
                 cmnt = cmnt.stripWhiteSpace();
-                if (!cmnt.isEmpty())
+                if (!cmnt.isEmpty()) {
                     m_source.append(m_singleLineCommentIntro + cmnt);
+                    m_srcIndex++;
+                }
             }
             endpos += 3;  // endpos now points behind the closed comment
             QString pre;
@@ -98,6 +101,7 @@
     if (pos != -1) {
         QString cmnt = line.mid(pos);
         m_source.append(cmnt);
+        m_srcIndex++;
         if (pos == 0)
             return true;
         line = line.left(pos);
@@ -217,6 +221,11 @@
         return true;
     }
     if (keyword == "def") {
+        if (m_klass == NULL) {
+            // skip functions outside of a class
+            skipBody();
+            return true;
+        }
         const QString& name = advance();
         // operation
         UMLOperation *op = Import_Utils::makeOperation(m_klass, name);




More information about the umbrello-devel mailing list