Fix issue in UML elements destructor

Change-Id: Id3f269b6c267803037b988f442f667f826423b25
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>