[Uml-devel] kdesdk/umbrello/umbrello/dialogs

Sebastian Stein seb.kde at hpfsc.de
Tue Jul 13 10:06:00 UTC 2004


CVS commit by sstein: 

leak fixes and a real bug fix:

==23607== 7480 bytes in 170 blocks are definitely lost in loss record 220 of 232
==23607==    at 0x3C01D54C: operator new(unsigned) (vg_replace_malloc.c:107)
==23607==    by 0x82339FB: CodeEditor::insert(QString const&, TextBlock*, bool, QColor const&, QColor const&, UMLObject*, QString const&, int) (codeeditor.cpp:260)
==23607==    by 0x8233DFD: CodeEditor::appendText(CodeComment*, TextBlock*, UMLObject*, QString const&) (codeeditor.cpp:378)
==23607==    by 0x8235199: CodeEditor::appendText(CodeMethodBlock*) (codeeditor.cpp:489)

==23607== Conditional jump or move depends on uninitialised value(s)
==23607==    at 0x3CEAA0F0: QGList::locate(unsigned) (in /usr/lib/qt-3.3.2/lib/libqt-mt.so.3.3.2)
==23607==    by 0x82386EA: CodeEditor::isParaEditable(int) (qglist.h:174)
==23607==    by 0x8237DD5: CodeEditor::cursorPositionChanged(int, int) (codeeditor.cpp:877)
==23607==    by 0x82392C0: CodeEditor::qt_invoke(int, QUObject*) (qucom_p.h:388)

==20759== 8 bytes in 2 blocks are definitely lost in loss record 32 of 231
==20759==    at 0x3C01D54C: operator new(unsigned) (vg_replace_malloc.c:107)
==20759==    by 0x8237695: CodeEditor::init(CodeViewerDialog*, CodeDocument*) (codeeditor.cpp:788)
==20759==    by 0x8232791: CodeEditor::CodeEditor(CodeViewerDialog*, char const*, CodeDocument*) (codeeditor.cpp:63)
==20759==    by 0x820DA0F: CodeViewerDialog::addCodeDocument(CodeDocument*) (codeviewerdialog.cpp:79)


  M +19 -5     codeeditor.cpp   1.21


--- kdesdk/umbrello/umbrello/dialogs/codeeditor.cpp  #1.20:1.21
@@ -67,12 +67,23 @@ CodeEditor::CodeEditor ( CodeViewerDialo
  *  Destroys the object and frees any allocated resources
  */
-CodeEditor::~CodeEditor() { }
+CodeEditor::~CodeEditor() {
+        clearText();
+        delete m_tbInfoMap;
+}
 
 // clear the display of all text
 void CodeEditor::clearText () {
 
-//        setCaption( tr2i18n("") );
         m_selectedTextBlock = 0;
+
+        // clearing the text means more then just calling clear()!
+        // because the data() is a pointer and must be deleted first
+        QMap<TextBlock*,TextBlockInfo*>::Iterator it;
+        for ( it = m_tbInfoMap->begin(); it != m_tbInfoMap->end(); ++it ) 
+        {
+                delete it.data();
+        }
         m_textBlockList.clear();
+
         m_tbInfoMap->clear();
 
@@ -771,4 +782,7 @@ void CodeEditor::init ( CodeViewerDialog
         parentDoc->synchronize();
 
+        // at startup there is no last parameter
+        m_lastPara = -1;
+
         m_parentDlg = parentDlg;
         m_parentDoc = parentDoc;






More information about the umbrello-devel mailing list