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

List:       kde-core-devel
Subject:    short-lived modeless dialogs (Re: modeless KFileDialog)
From:       Sirtaj Singh Kang <ssk () physics ! unimelb ! EDU ! AU>
Date:       2000-01-27 13:22:10
[Download RAW message or body]

Hi,

Something that has bothered me for some time is the deletion of
dialogs that are no longer needed, in a slot connected to their
close() signal.

I've found two cases where this can be done safely:

1. The dialog does not access any of its internal variables or
functions after the done signal is emitted (ie it doesn't care any
more that this is pointing to a deleted object).

Pro: Simple to use from calling code.
Con: Many KDE dialogs don't adhere to this.

2. Start a timer that deletes the object after a few seconds. This
should ensure that the object is safe to delete.

Pro: Works with most dialogs.
Con: More code to write.

Arnt one mentioned that Qt internally handles deletion of signal emitter
properly on deletion in a connected slot. But

-> Is there a silver bullet to make this safe for all  dialogs?
-> If not, does it actually save memory to delete dialogs that are not
in current use?

Any input/opinions appreciated.

-Taj.

Sirtaj S. Kang       taj@kde.org         ssk@physics.unimelb.edu.au
Univ of Melbourne	The "gui" in "Penguin" is pronounced "K-D-E"

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

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