[Qt-interest] Handle object deletions right with containers (not-working stripped example)

Wilhelm wilhelm.meier at fh-kl.de
Mon Aug 8 20:56:35 CEST 2011


Am 08.08.2011 15:05, schrieb Bo Thorsen:
> Den 08-08-2011 14:34, Wilhelm skrev:
>> Hi,
>>
>> Am 08.08.2011 13:46, schrieb Bo Thorsen:

[...]

> That's not true. You can de-couple this by using an interface (a 
> standard visitor pattern).
> 
> Contained::~Contained() {
>   foreach (DeleteListener* dl, deleteListeners)
>    dl->aboutToDelete(this);
> }
> 

what about (avoids the use of the additional interfaces and is more
qt-like):

Contained::~Contained() {
	emit destroyed();
}


-- 
Wilhelm




More information about the Qt-interest-old mailing list