On Fri, 23 Sep 2011 13:28:47 +1200, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
clemens.zeidler@xxxxxxxxxxxxxx wrote:Author: czeidler Date: 2011-09-23 00:46:14 +0200 (Fri, 23 Sep 2011) New Revision: 42764 Changeset: https://dev.haiku-os.org/changeset/42764 Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp Log:Switch to BWeakReference class. Hope this does not break anything. Calling virtual destructur on a structshould work fine, right?There is no difference between struct and class other than the default accessibility of base classes and members.Anyway, I noticed that it is never checked whether the allocation the BWeakReferenceable constructor performs actually succeeds (it also uses the throwing new). I haven't checked whether that issue already existed before your change, but it's obviously a no-go for kernel code.
oh yes, fixed now, assume there is no smarter way to do it? maybe a overloaded new operator that cleans up when failing to create the WeakPointer?