diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-03 13:55:31 -0400 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-03 19:56:23 +0200 |
commit | 6dede46801708c1a176b9debb1418e921078e8ca (patch) | |
tree | 2b63d42826b41ec038082eb3d1d10ef48b47963b /scripts/templates/qclass.cpp | |
parent | d29c0472802aa1a1c5ee7fac01f400bdc1465337 (diff) |
Fix issue in UML elements destructor
Change-Id: Id3f269b6c267803037b988f442f667f826423b25
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates/qclass.cpp')
-rw-r--r-- | scripts/templates/qclass.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index 52b9b4c3..09c60c44 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -127,7 +127,8 @@ Q${namespace}${className}::~Q${namespace}${className}() { [%- IF class.findvalue("@isAbstract") != "true" %] if (!deletingFromQObject) { - _qObject->setProperty("deletingFromModelingObject", true); + if (_qObject) + _qObject->setProperty("deletingFromModelingObject", true); delete _qObject; } [%- END %] @@ -194,7 +195,7 @@ void Q${namespace}${className}::add${attributeName}(${qtType.remove("QSet<").rem if (!_${qtAttribute}.contains(${qtAttribute})) { _${qtAttribute}.[% IF qtType.match("QList") %]append[% ELSE %]insert[% END %](${qtAttribute}); [%- IF qtType.match('\*') %] - if (${qtAttribute}->asQObject() && this->asQObject()) + if (${qtAttribute} && ${qtAttribute}->asQObject() && this->asQObject()) QObject::connect(${qtAttribute}->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(remove${attributeName}(QObject *))); [%- IF attribute.findvalue("@aggregation") == "composite" %] ${qtAttribute}->asQObject()->setParent(this->asQObject()); @@ -332,7 +333,7 @@ void Q${namespace}${className}::set${attributeName.remove("^Is")}([% IF !qtType. [%- ELSE %] _${qtAttribute} = ${qtAttribute}; [%- IF qtType.match('\*') %] - if (${qtAttribute}->asQObject() && this->asQObject()) + if (${qtAttribute} && ${qtAttribute}->asQObject() && this->asQObject()) QObject::connect(${qtAttribute}->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(set${attributeName}())); [%- IF attribute.findvalue("@aggregation") == "composite" %] ${qtAttribute}->asQObject()->setParent(this->asQObject()); |