Thanks for your replay. But, how delete that object. I modified your code sample...
void doExec() {
tahede()->exec();
}
void doDelete() {
delete _tahede;
}
protected:
Tahede* tahede() {
if(!_tahede)
{
_tahede = new Tahede(this);
qDebug() << "Create now";
}
else
{
qDebug() << "Created before";
}
return _tahede;
}
private:
Tahede* _tahede;
void doExec() {
tahede()->exec();
}
void doDelete() {
delete _tahede;
}
protected:
void changeEvent(QEvent *e);
Tahede* tahede() {
if(!_tahede)
{
_tahede = new Tahede(this);
qDebug() << "Create now";
}
else
{
qDebug() << "Created before";
}
return _tahede;
}
private:
Tahede* _tahede;
To copy to clipboard, switch view to plain text mode
void Dialog::on_pushButton_clicked()
{
doExec();
}
void Dialog::on_pushButton_2_clicked()
{
doDelete();
}
void Dialog::on_pushButton_clicked()
{
doExec();
}
void Dialog::on_pushButton_2_clicked()
{
doDelete();
}
To copy to clipboard, switch view to plain text mode
After I deleted with doDelete() function, and doExec() again, Application output still give me message "Created before" and my application crash What's wrong ?
Bookmarks