Bug 112552 - Crashes when trying to move attribute 2 steps up in Class Property Dialog (only happens with Advanced Code Generators)
Summary: Crashes when trying to move attribute 2 steps up in Class Property Dialog (on...
Status: RESOLVED WORKSFORME
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-13 20:06 UTC by Emil Karlén
Modified: 2009-08-08 22:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
UML model with attribute which can't be moved (59.27 KB, application/x-bzip2)
2005-09-13 20:11 UTC, Emil Karlén
Details
backtrace (5.02 KB, text/plain)
2005-09-15 21:56 UTC, Oliver Kellogg
Details
UML-model with attribute which can't be moved up (364.95 KB, application/x-umbrello)
2005-09-24 11:13 UTC, Emil Karlén
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Karlén 2005-09-13 20:06:30 UTC
Version:           1.4.89 (using KDE KDE 3.4.2)
Installed from:    Fedora RPMs
Compiler:          gcc (GCC) 4.0.1 20050727 (Red Hat 4.0.1-5) 
OS:                Linux

How to reproduce:

1. Open the model "craches_on_move_attr-funDefaultDbvs2PresStr-2_steps_up.xmi" (attached).
2. Double-click the yellow class "PresInfo" and select the attributes tab.
3. Try to move the last one, "funDefaultDbvs2PresStr", 2 steps up (to the top): CRASH

One step works fine but the second doesn't.

The UML-model is a non-trivial one, and not stripped in any way. If you find it interesting I could try to do that.
Comment 1 Emil Karlén 2005-09-13 20:11:39 UTC
Created attachment 12553 [details]
UML model with attribute which can't be moved

The file is bz2-compressed to make it a bit smaller.

The attribute which can't be moved is
"webdblib::attribute::PresInfo.funDefaultDbvs2PresStr".
Comment 2 Oliver Kellogg 2005-09-13 22:07:44 UTC
Mysterious. I deselected "Use new code generators" in the Umbrello
config menu and removed all of the <codegenerator> XMI contents
like so:
  <codegeneration>
   <codegenerator language="C++" />
  </codegeneration>
and then the crash doesn't happen.

FYI there had been a bug like this before, http://bugs.kde.org/103123
but it was fixed already on 2005-04-04 by commit number 403020.
Comment 3 Emil Karlén 2005-09-14 15:19:44 UTC
Found a simple solution after your observation:
 Changed
   "<codegenerator language="Cpp"
 to
   "<codegenerator language="C++"
with alla subelements of <codegenerator> left, and also ""Use new code generators" left ON.

The id for the c++-languge seems to have changed. Although the symptom of this inconsistency in the old XMI-file is a bit strange!


Bugreporting: I am a newbie in bugreporting, should I have reported this on the old bug you mentioned, although it is fixed?
Comment 4 Emil Karlén 2005-09-14 15:37:27 UTC
Your comment gave me a bit of deja-vu-feeling. I remeber that I have earliers solved a few situations with Umbrello crashes on exit by removing all not absolutely nessecary info. from the XMI-file - such as info. on codegeneration and listitems, although I never cared to find out exactly what was the solution.
The above situations all arised as of the following scenario:
1. Working on a model without any problems.
2. Some operation caused a crash.
3. Opening the model as saved before the crash.
4. Edit without any problems.
5. File | Quit ===> CRASH

It seemed to me that some operations leaved the internal representation of the XMI-file and the physical XML-file in a inconsistent state, but not "enough" inconsistent to have Umbrello complain about it when opening the file.
I started looking for a XML schema or other app to be able to verify the consistency of the XMI-file, and this bug causes me wanting to have one again!
I myself find xml-schemas and dtd great tools for checkin both input and output to and from programs, and if you developers have someting like that, please let me know!

Bugreporting, since I am a newbie, should I mark it as resloved now?
Comment 5 Oliver Kellogg 2005-09-14 21:25:58 UTC
> The id for the c++-language seems to have changed.
For the old code generator, the id is "C++" while for the
new code generator, the id is "Cpp". So this probably means
that the new code generator is not effective when you change
the id to "C++" (I think.)

> 1. Working on a model without any problems. 
> 2. Some operation caused a crash. 
> 3. Opening the model as saved before the crash. 
> 4. Edit without any problems. 
> 5. File | Quit ===> CRASH 

Please attach the backtrace (from the KDE Crash Handler)

> Bugreporting, since I am a newbie, should I mark it as resloved now? 
 
Well if you're getting crashes then I guess it's not resolved :-)

Comment 6 Emil Karlén 2005-09-15 12:29:41 UTC
I didn't express myself very clear: the earlier situations when Umbrello crashes on exit are gone! (Thinkt it was when upgrading to kde 3.4, but I mot sure!)
Comment 7 Oliver Kellogg 2005-09-15 18:53:50 UTC
> I didn't express myself very clear: the earlier situations when Umbrello
> crashes on exit are gone!

Anyway, the crash on reordering attributes while a new code generator
is active remains, so the bug remains open.
Comment 8 Oliver Kellogg 2005-09-15 21:56:54 UTC
Created attachment 12583 [details]
backtrace

CPPHeaderCodeClassFieldDeclarationBlock::updateContent():
    ...
    // Set the comment
    QString notes = getParentObject()->getDoc();

The getParentObject() returns NULL.
(I have no idea what's happening. Brian?)
Comment 9 Oliver Kellogg 2005-09-19 05:43:15 UTC
SVN commit 461904 by okellogg:

BUG:112552 - slot{Up,Down}Clicked(): Reset the m_pOldListItem.

 M  +1 -1      ChangeLog  
 M  +9 -6      umbrello/dialogs/classifierlistpage.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #461903:461904
@@ -11,7 +11,7 @@
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
  57588  57672  58809  66461  67120  67719  72016  79433  87252  88117
  97162 105564 108223 109591 109636 110073 110216 110231 110379 111088
-111470 111502 111759 111768 112017 112293 112333
+111470 111502 111759 111768 112017 112292 112293 112333 112531 112552
 
 Version 1.4.2 (maintenance release)
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/dialogs/classifierlistpage.cpp #461903:461904
@@ -179,12 +179,13 @@
     //
     // for more information see Qt doc for void QListBox::clearSelection()
     UMLClassifierListItem* listItem;
-    if(!item && m_pItemListLB->count() == 0) {
-        enableWidgets(false);
-        m_pOldListItem = 0;
-        m_pItemListLB->clearSelection();
-        return;
-    } else if (!item && m_pItemListLB->count() > 0) {
+    if (item == NULL) {
+        if (m_pItemListLB->count() == 0) {
+            enableWidgets(false);
+            m_pOldListItem = 0;
+            m_pItemListLB->clearSelection();
+            return;
+        }
         m_pItemListLB->setSelected(0, true);
         listItem = getItemList().at(0);
     } else {
@@ -327,6 +328,7 @@
     //shouldn't occur, but just in case
     if( count <= 1 || index <= 0 )
         return;
+    m_pOldListItem = NULL;
 
     //swap the text around in the ListBox
     QString aboveString = m_pItemListLB->text( index - 1 );
@@ -354,6 +356,7 @@
     //shouldn't occur, but just in case
     if( count <= 1 || index >= count - 1 )
         return;
+    m_pOldListItem = NULL;
 
     //swap the text around in the ListBox
     QString belowString = m_pItemListLB->text( index + 1 );
Comment 10 Emil Karlén 2005-09-24 11:13:13 UTC
Created attachment 12685 [details]
UML-model with attribute which can't be moved up

I am again experiencing crashes when trying to move attributes.

Steps to reproduce:

1. Select the diagram RUP - Detaljer
2. Doubleclick "Iteration" and selecte the tab "Attributes".
3. Select the attribute "sName : LongName" and move it up two steps.
Crash!

Version: 1.4.90 (KE 3.4.2-0.fc4)
Commit:  463471
Comment 11 Emil Karlén 2005-09-24 11:18:16 UTC
It seems to be the problem with new code generators again. If I deselect "Use new C++/Java ..." and save the model, quit and restart, the problem does not occur.
Comment 12 Oliver Kellogg 2005-09-24 22:22:29 UTC
The crash is related to attribute removal in the CPPSourceCodeDocument.
The trace for attribute removal differs vastly from the one for attribute
creation as can be seen by setting breakpoints on ClassifierCodeDocument
::{add,remove}AttributeClassField() and pressing the up or down arrow:

ClassifierCodeDocument::addAttributeClassField() ->
 CPPSourceCodeDocument::newCodeClassField() ->
  CPPCodeClassField() ->
   CodeClassField() -> CodeClassField::initFields() ->
    CPPSourceCodeDocument::newDeclarationCodeBlock() ->
     CPPSourceCodeClassFieldDeclarationBlock() ->
       CodeClassFieldDeclarationBlock()

ClassifierCodeDocument::removeAttributeClassField() ->
 ClassifierCodeDocument::removeCodeClassField() ->
  classifiercodedocument.cpp:197    delete remove_object; ->
   CodeClassField::~CodeClassField() -> m->forceRelease(); ->
    CodeAccessorMethod::forceRelease() ->
     CodeMethodBlock::release() -> OwnedCodeBlock::release() ->
       CodeClassFieldDeclarationBlock::forceRelease()

Hmph. Now I'll have to try to wrap my head around this stuff :-/
Comment 13 Oliver Kellogg 2005-09-24 22:27:31 UTC
Others might be better at fixing this (B.T.?)
Comment 14 Oliver Kellogg 2007-02-17 15:28:02 UTC
In order to work on this problem, specify -DBUG84739_FIXED in the CFLAGS
of Umbrello's main Makefile, see http://bugs.kde.org/84739
Comment 15 FiNeX 2009-08-08 22:01:41 UTC
The bug reported initially is no more reproducible: moving up and down items on the provided test case works fine.

The attachment of comment #10 makes umbrello crash (I'll open a new report against it).