Summary: | Crash when trying to create a function of the type Vector<package.class>. (JavaClassifierCodeDocument::addCodeOperation) | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | jan0sch <jan0sch> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | andresbajotierra, gerard.sauvage, happy.matthias, jtaller2006, lluisgifrerenom, mule98, okellogg, ralf.habacker |
Priority: | NOR | ||
Version: | 2.6.5 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/umbrello/23c4a33effb2fb88a20a09a87b0eb89b1de53b9b | Version Fixed In: | 2.15.0 (KDE 14.12.0) |
Attachments: |
test case
full backtrace for comment 11 Dirty hack to avoid crash using new code generator |
Description
jan0sch
2009-08-16 12:27:57 UTC
I just could manage to make it work. The crash occured whenever I tried to add the mentioned function to an interface from which existed an abstract class. I could add the function to the abstract class without problems and _afterwards_ I could add it to the interface. It seems to work for now. Although I guess this behaviour is not intended?!? [Comment from a bug triager] New information from bug 256668: -- Information about the crash: When the crash occured i just imported a full project for UML modelling. But my interface didn't have the method defined in the java class. So I tried to add it manually. This method must return a Map<String, String>. When i validated the add action it crashed *** Bug 256668 has been marked as a duplicate of this bug. *** *** Bug 281901 has been marked as a duplicate of this bug. *** *** Bug 281612 has been marked as a duplicate of this bug. *** *** Bug 307949 has been marked as a duplicate of this bug. *** Dear Sir, I would not mark my bug as duplicate of 204035 for the following reason. The 204035 complains about a fancy complicated return type (Vector). In my case, I had a simple method in fact returning void that I was trying copy and paste. Therefore I would leave my bug in and I would let the developers to solve the simple case (return void) before they go and chase Vectors. On the other hand, it may be that in 204035 the Vector part is irrelevant and again the problem of copy and paste method occurs and is independent of return type. It may be just copy and paste method does not work for any simple method. In my case the method signature and type is: void print(). This is my view. --regards ________________________________ From: Jekyll Wu <adaptee@gmail.com> To: jtaller2006@yahoo.com Sent: Friday, October 5, 2012 6:25 PM Subject: [Bug 204035] Crash when trying to create a function of the type Vector<package.class>. (JavaClassifierCodeDocument::addCodeOperation) https://bugs.kde.org/show_bug.cgi?id=204035 Jekyll Wu <adaptee@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jtaller2006@yahoo.com --- Comment #6 from Jekyll Wu <adaptee@gmail.com> --- *** Bug 307949 has been marked as a duplicate of this bug. *** *** Bug 311149 has been marked as a duplicate of this bug. *** The function mentioned in the last stack frame is shown below: bool JavaClassifierCodeDocument::addCodeOperation (CodeOperation * op) { if(!op->getParentOperation()->isLifeOperation()) return operationsBlock->addTextBlock(op); else return constructorBlock->addTextBlock(op); } There may be three places where a crash can happen: 1. op->getParentOperation() == 0 2. operationsBlock == 0 3. constructorBlock == 0 Created attachment 89758 [details]
test case
Adding a method to the interface of the appended test case let umbrello also crash with 14.12 branch.
(In reply to Ralf Habacker from comment #9) > The function mentioned in the last stack frame is shown below: > > bool JavaClassifierCodeDocument::addCodeOperation (CodeOperation * op) > { > if(!op->getParentOperation()->isLifeOperation()) > return operationsBlock->addTextBlock(op); > else > return constructorBlock->addTextBlock(op); > } > > There may be three places where a crash can happen: > 1. op->getParentOperation() == 0 > 2. operationsBlock == 0 > 3. constructorBlock == 0 With selected umbrello setting "Use new C++/Java/Ruby generators" the above mentioned crash happens because of case 2. and 3. With unselected umbrello setting "Use new C++/Java/Ruby generators" the above mentioned crash happens in void JavaClassDeclarationBlock::updateContent () { JavaClassifierCodeDocument *parentDoc = dynamic_cast<JavaClassifierCodeDocument*>(getParentDocument()); because parentDoc is zero and not guarded later. UMLClassifier *c = parentDoc->getParentClassifier(); CodeGenerationPolicy *commonPolicy = UMLApp::app()->commonPolicy(); QString endLine = commonPolicy->getNewLineEndingChars(); bool isInterface = parentDoc->parentIsInterface(); // a little shortcut QString JavaClassName = parentDoc->getJavaClassName(c->name()); The top related backtrace part is #0 0x00007ffff404224a in __dynamic_cast () from /usr/lib64/libstdc++.so.6 #1 0x0000000000524b72 in JavaClassDeclarationBlock::updateContent (this=0x164f690) at /home/ralf/src/umbrello-14.12/umbrello/codegenerators /java/javaclassdeclarationblock.cpp:53 #2 0x00007ffff469db38 in QMetaObject::activate (sender=sender@entry=0x10cab90, m=m@entry=0x6fa720 <UMLObject::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3576 #3 0x0000000000657e6e in UMLObject::modified (this=this@entry=0x10cab90) at /home/ralf/src/umbrello-14.12-build/umbrello/umlobject.moc:145 No locals. #4 0x0000000000657eaf in UMLObject::emitModified (this=this@entry=0x10cab90) at /home/ralf/src/umbrello-14.12/umbrello/umlobject.cpp:354 umldoc = <optimized out> #5 0x00000000005f5907 in UMLClassifier::addOperation (this=this@entry=0x10cab90, op=op@entry=0x1384c00, position=position@entry=-1) at /home/ralf/src/umbrello-14.12/umbrello/classifier.cpp:338 __PRETTY_FUNCTION__ = "bool UMLClassifier::addOperation(UMLOperation*, int)" #6 0x00000000005f5dac in UMLClassifier::createOperation (this=this@entry=0x10cab90, name=..., isExistingOp=isExistingOp@entry=0x0, params=params@entry=0x0) at /home/ralf/src/umbrello-14.12/umbrello/classifier.cpp:294 #7 0x000000000061ecfd in Object_Factory::createChildObject (parent=parent@entry=0x10cab90, type=type@entry=UMLObject::ot_Operation, name=...) at /home/ralf/src/umbrello-14.12/umbrello/object_factory.cpp:308 #8 0x00000000005bf0a3 in ClassifierWidget::slotMenuSelection (this=0x10c6ad0, action=<optimized out>) at /home/ralf/src/umbrello-14.12/umbrello/widgets/classifierwidget.cpp:1278 #9 0x00000000005e7be0 in WidgetBase::contextMenuEvent (this=<optimized out>, event=0x7fffffffd1b0) at /home/ralf/src/umbrello-14.12/umbrello/widgets/widgetbase.cpp:746 Created attachment 89760 [details] full backtrace for comment 11 Created attachment 89787 [details]
Dirty hack to avoid crash using new code generator
Git commit 64b98668dad5e38af44042e8daafd11d1a501c10 by Ralf Habacker. Committed on 01/12/2014 at 23:26. Pushed by habacker into branch 'Applications/14.12'. Fix 'Crash when trying to create a function of the type Vector<package.class>.' Guard access to member constructorBlock and operationsBlock of class JavaClassifierCodeDocument because they could be zero. FIXED-IN:2.15.0 (KDE 14.12.0) M +2 -2 umbrello/codegenerators/java/javaclassifiercodedocument.cpp http://commits.kde.org/umbrello/64b98668dad5e38af44042e8daafd11d1a501c10 (In reply to Ralf Habacker from comment #11) > [...] > With unselected umbrello setting "Use new C++/Java/Ruby generators" the > above mentioned crash happens in > > void JavaClassDeclarationBlock::updateContent () Yikes, this sounds very wrong! When using the "old" Java generator (JavaWriter) there should be no JavaClassDeclarationBlock constructed at all. In fact only a JavaWriter object should exist; none of the other classes of umbrello/codegenerators/java/ should exist. (In reply to Oliver Kellogg from comment #15) > (In reply to Ralf Habacker from comment #11) > > [...] > > With unselected umbrello setting "Use new C++/Java/Ruby generators" the > > above mentioned crash happens in > > > > void JavaClassDeclarationBlock::updateContent () > > Yikes, this sounds very wrong! > When using the "old" Java generator (JavaWriter) there should be no > JavaClassDeclarationBlock constructed at all. In fact only a JavaWriter > object should exist; none of the other classes of > umbrello/codegenerators/java/ should exist. Unfortunally I could not reproduce this crash yet, but looking at the code there is at least a resource leak with "use new code generators" in QStringList CodeTextHighlighter::keywords() { Uml::ProgrammingLanguage::Enum pl = UMLApp::app()->activeLanguage(); !!! CodeGenerator* generator = CodeGenFactory::createObject(pl); QStringList keywordList = generator->reservedKeywords(); With java as active language a new ClassifierCodeDocument instance is created, which connects an UMLClassifier instance to ClassifierCodeDocument::syncToParent(). classifiercodedocument.cpp:446 connect(c, SIGNAL(modified()), this, SLOT(syncToParent())); but the generator is never freed. After changing to "use old code generators" this connection (and others) are still present and may result into unwanted calls. BTW: This leak has not been detected by coverige. Git commit 9372a51b496397cbf7ae82d8e6925d72610b18a5 by Ralf Habacker. Committed on 09/12/2014 at 10:01. Pushed by habacker into branch 'Applications/14.12'. Fix resource leak and potiental crash cause. The local variable 'generator' of CodeTextHighlighter::keywords() gets a new instance of the class CodeGenerator, but is never been free'd and there are active signal/slots connections non deterministic crashes occurs. M +1 -0 umbrello/dialogs/codetexthighlighter.cpp http://commits.kde.org/umbrello/9372a51b496397cbf7ae82d8e6925d72610b18a5 Git commit 23c4a33effb2fb88a20a09a87b0eb89b1de53b9b by Andi Fischer, on behalf of Ralf Habacker. Committed on 09/12/2014 at 10:01. Pushed by fischer into branch 'frameworks'. Fix resource leak and potiental crash cause. The local variable 'generator' of CodeTextHighlighter::keywords() gets a new instance of the class CodeGenerator, but is never been free'd and there are active signal/slots connections non deterministic crashes occurs. M +1 -0 umbrello/dialogs/codetexthighlighter.cpp http://commits.kde.org/umbrello/23c4a33effb2fb88a20a09a87b0eb89b1de53b9b |