On Mon, Apr 15, 2013 at 6:21 AM, "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote: >> http://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/network/notifications/notifications.cpp/#n136 >> >> Given how that object's being used, I'm somewhat unclear on why it's a >> BReferenceable subclass at all, since that seems a bit unsafe for a >> statically allocated object. > > The BReferenceable is in fact not used there to destroy the object, but only > to > keep the module loaded in the first place as long as it is in use. > Why exactly does it panic? The above line of code eventually winds up invoking the BReferenceable destructor while the object ref count is non-zero, which is something that's sanity checked for a DEBUG build. We make a special exception for ref count == 1 and an object in the stack address range, which this one is not, hence panic. Regards, Rene