[Qt-interest] Will it cause a memory leak?

Kermit Mei kermit.mei at gmail.com
Thu Jul 9 13:05:50 CEST 2009


On Thu, 2009-07-09 at 11:55 +0100, Donal O'Connor wrote:
> No, I would say not. From the docs:
> 
> 
> void QApplication::postEvent ( QObject * receiver, QEvent * event )
> [static]
> Note: This function is thread-safe when Qt is built withthread
> support.
> 
> Adds the event event with the object receiver as the receiver of the
> event, to an event queue and returns immediately. 
> 
> The event must be allocated on the heap since the post event queue
> will take ownership of the event and delete it once it has been
> posted.

Oh,thanks,and I'm sorry for my negligence:p
> 
> When control returns to the main event loop, all events that are
> stored in the queue will be sent using the notify() function.
> 

<snip>




More information about the Qt-interest-old mailing list