Commit d7c8fa9f authored by Ralf Habacker's avatar Ralf Habacker

Fix crash on document close caused by dangled pointer in UMLObject::m_pUmlPackage.

I was not able to find a short test case for reproducing the crash.
Because using QPointer has no drawbacks it is always better to fix it.
parent 6b9cdff4
......@@ -238,7 +238,7 @@ bool UMLAssociation::load(QDomElement & element)
m_AssocType == Uml::AssociationType::Category2Parent) {
QString general = element.attribute(QLatin1String("general"));
if (!general.isEmpty()) {
UMLClassifier *owningClassifier = dynamic_cast<UMLClassifier*>(m_pUMLPackage);
UMLClassifier *owningClassifier = dynamic_cast<UMLClassifier*>(m_pUMLPackage.data());
if (owningClassifier == NULL){
uWarning() << "Cannot load UML2 generalization: m_pUMLPackage is expected "
<< "to be the owning classifier (=client)";
......
......@@ -171,7 +171,7 @@ protected:
Uml::ID::Type m_nId; ///< object's id
QString m_Doc; ///< object's documentation
UMLPackage* m_pUMLPackage; ///< package the object belongs to if applicable
QPointer<UMLPackage> m_pUMLPackage; ///< package the object belongs to if applicable
QPointer<UMLStereotype> m_pStereotype; ///< stereotype of the object if applicable
QString m_name; ///< objects name
ObjectType m_BaseType; ///< objects type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment