Bug 108688 - Generating Javascript Code from a Class diagram hangs Umbrello
Summary: Generating Javascript Code from a Class diagram hangs Umbrello
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.4
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
: 110096 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-07 11:31 UTC by Peter Sabaini
Modified: 2005-08-03 18:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Sabaini 2005-07-07 11:31:57 UTC
Version:           1.4 (using KDE 3.4.0, Debian Package 4:3.4.0-0ubuntu3.2 (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8ubuntu2)
OS:                Linux (i686) release 2.6.10-5-386

* Created a class diagram in Umbrello
* Generated Python code -- works
* Generate Javascript 
  -- Umbrello becomes unresponsive
  -- Consumes a lot of RAM (>450Mb)
  -- Had to kill the process (SIGTERM works)
Comment 1 Oliver Kellogg 2005-07-08 05:50:34 UTC
SVN commit 432648 by okellogg:

formatDoc(): Fix glaring bug in the loop for splitting up a single line.
BUG:108688


 M  +5 -3      codegenerator.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerator.cpp #432647:432648
@@ -669,10 +669,10 @@
  * @param	linewidth
  */
 QString CodeGenerator::formatDoc(const QString &text, const QString &linePrefix, int lineWidth) {
-    QString output, comment(text);
+    QString output;
 
     const QString endLine = getNewLineEndingChars();
-    QStringList lines = QStringList::split(endLine, comment);
+    QStringList lines = QStringList::split(endLine, text);
     for (QStringList::ConstIterator lit = lines.begin(); lit != lines.end(); ++lit) {
         QString input = *lit;
         input.remove( QRegExp("\\s+$") );
@@ -682,7 +682,9 @@
         }
         int index;
         do {
-            index = comment.findRev(" ", lineWidth + 1);
+            index = input.findRev(" ", lineWidth + 1);
+            if (index == -1)
+                break;
             output += linePrefix + input.left(index) + endLine; // add line
             input.remove(0, index + 1);	//and remove processed string, including
             // white space
Comment 2 Oliver Kellogg 2005-08-03 18:04:35 UTC
*** Bug 110096 has been marked as a duplicate of this bug. ***