[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: trivial KDE program crashing
From:       George Petri <baitfish () bigpond ! com>
Date:       2001-09-09 3:58:21
[Download RAW message or body]


So I can use QT as if I was programming in Java i.e. do not deallocate memory?
I'm just worried that if I don't delete objects, I'll get a memory leak.
How is it technically possible to automatically delete objects in C++?

Thanks again,
george

On Sunday 09 September 2001 11:19, David Watson wrote:
> I'm pretty sure that all QWidgets need to be allocated on the heap, not the
> stack, because of the auto-deletion stuff - your KApplication deletes the
> KMainWindow (that's why you pass a pointer). Since you dynamically
> allocated your main window in the non-crashing version, it's fine when it
> gets deleted.
>
> Basically, you need to use new for all widgets, and you DON'T delete them
> manually (except in certain cases), because QT does it for you when the
> parent is destroyed.
>
> Hope this helps :).
>
> -David
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic