diff options
author | Daniel Molkentin <daniel.molkentin@nokia.com> | 2009-05-20 13:53:07 (GMT) |
---|---|---|
committer | Daniel Molkentin <daniel.molkentin@nokia.com> | 2009-05-20 14:02:42 (GMT) |
commit | afa4bcc90f79f3a68bed3f3429f2515fc8c7d23d (patch) | |
tree | 215bcc40689989271c63fede757205ff43f25e9b /doc/src/tutorials | |
parent | 4a756726ee874ff2ce496e1b113707c65c39a76b (diff) | |
download | Qt-afa4bcc90f79f3a68bed3f3429f2515fc8c7d23d.zip Qt-afa4bcc90f79f3a68bed3f3429f2515fc8c7d23d.tar.gz Qt-afa4bcc90f79f3a68bed3f3429f2515fc8c7d23d.tar.bz2 |
Changing the addressbook tutorial so it doesn't leak.
Reviewed-By: Kavindra Palaraja <kavindra.palaraja@nokia.com>
Diffstat (limited to 'doc/src/tutorials')
-rw-r--r-- | doc/src/tutorials/addressbook.qdoc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 3b0d2bc..38200b0 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -242,12 +242,15 @@ \snippet tutorials/addressbook/part1/main.cpp main function - We construct a new \c AddressBook widget on the heap using the \c new - keyword and invoke its \l{QWidget::show()}{show()} function to display it. + We construct a new \c AddressBook widget on the stack and invoke + its \l{QWidget::show()}{show()} function to display it. However, the widget will not be shown until the application's event loop is started. We start the event loop by calling the application's \l{QApplication::}{exec()} function; the result returned by this function - is used as the return value from the \c main() function. + is used as the return value from the \c main() function. At this point, + it becomes apparent why we instanciated \c AddressBook on the stack: It + will now go out of scope. Therefore, \c AddressBook and all its child widgets + will be deleted, thus preventing memory leaks. */ /*! |