[umbrello-devel] [umbrello] [Bug 341709] Crash while importing C++ code from existing project
Ralf Habacker
ralf.habacker at freenet.de
Fri Dec 12 08:55:43 UTC 2014
https://bugs.kde.org/show_bug.cgi?id=341709
--- Comment #16 from Ralf Habacker <ralf.habacker at freenet.de> ---
(In reply to Oliver Kellogg from comment #13)
> (In reply to Ralf Habacker from comment #11)
> > There is a surprising dynamic_cast problem inModel_Utils::findUMLObject()
> >
> > At line 202 there is an access to the package child objects:
> > 202: UMLObjectList objectsInCurrentScope = pkg->containedObjects();
> > [...]
> > In the crash case the package is an UMLAssociation instance, which does
> > support objects.
>
> I don't understand: UMLAssociation is not derived from UMLPackage.
I also do not understand the reason why a dynamic_cast<UMLPackage*> of an
UMLAssociation instance does not return 0. :-(
> In fact, in line 179:
> if (pkg == NULL || pkg->baseType() == UMLObject::ot_Association)
> pkg = currentObj->umlPackage();
> the RHS of the "||" should never become true (?)
This is not the source of the problem. The probolem happens later in the loop
To see some details I added the following code:
#define EMBED_BREAKPOINT asm volatile ("int3;")
for (; pkg; pkg = currentObj->umlPackage()) {
if (pkg->umlPackage() && pkg->umlPackage()->baseType() ==
UMLObject::ot_Association) {
qDebug() << "1" << pkg << pkg->umlPackage() <<
pkg->umlPackage()->umlPackage();
UMLPackage *p = dynamic_cast<UMLPackage*>(pkg->umlPackage());
qDebug() << "2" << p;
EMBED_BREAKPOINT;
}
imported the appended test case and got a break with the following output:
1 UMLClassifier(0x3ff3ef0, name = "UMLObject") UMLAssociation(0x197a7e0, name =
"UMLObject") UMLFolder(0xe405b0, name = "UMLObject")
2 UMLAssociation(0x197a7e0, name = "UMLObject")
1. shows that an UMLAssociation instance is a parent of an UML Classifier
- package class name is 'testing'
- the parent is a dependency with
- Role A - class "ConstraintPackage"
- Role B - class "ConstraintPackageField"
2. shows a failed dynamic_cast
--
You are receiving this mail because:
You are the assignee for the bug.
Make the world a better place. Donate to our year end fundraiser https://www.kde.org/fundraisers/yearend2014/
More information about the umbrello-devel
mailing list