mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 04:52:17 +02:00
Don't call delete later unless you have to
This commit is contained in:
parent
336378679f
commit
6d67b8e20c
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
#define hifi_DependencyManager_h
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QDebug>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
|
@ -22,10 +23,12 @@ public:\
|
|||
private:\
|
||||
void customDeleter() {\
|
||||
QObject* thisObject = dynamic_cast<QObject*>(this);\
|
||||
if (thisObject) {\
|
||||
if (thisObject && thisObject->parent()) {\
|
||||
thisObject->deleteLater();\
|
||||
qDebug() << "Delete later:" << #T;\
|
||||
} else {\
|
||||
delete this;\
|
||||
qDebug() << "Deleted:" << #T;\
|
||||
}\
|
||||
}\
|
||||
friend class DependencyManager;
|
||||
|
|
Loading…
Reference in a new issue