指针管理有关问题

指针管理问题

在Run类中new了一个Test
C/C++ code
 Test *t=new Test();
  t.show();



Test是这样的
C/C++ code


void Widget::enterEvent(QEvent *e){
   i=1;
}

void Widget::leaveEvent(QEvent *e){
    if(i==1){
     this->deleteLater();
    }
}


就是鼠标移除之后自己删除、

请问这个有木有内存泄露

Run类的t指针还需要销毁吗?

------解决方案--------------------
可以看看Qt助手对deleteLater的解释
------解决方案--------------------
Schedules this object for deletion.

The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started.

Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.

Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue.

See also destroyed() and QPointer.