I need some explanation about the next situation. Assume we have the next code:
class MyClass : public QObject
{
public:
MyClass(QObject* parent = nullptr)
{
m_member.reset(new QObject(this));
}
~MyClass(){} override;
private:
QScopedPointer< QObject> m_member;
};
I can't understand if it's safe to pass an object with a parent to QScopedPointer. Might it be any situation when the object is deleted twice by the parent and by the smart pointer and it will lead to a crash?