Re: weird diagnostics from trivial Bonobo server

Ben Liblit <[email protected]> Mon, 08 Sep 2003 19:19:09 -0700
Newsgroups gmane.comp.gnome.components
Message-ID <[email protected]>
I hereby hang my head in shame for not looking at the source first. 
Once I found the place where this message is printed....

>     Bonobo-WARNING **: It looks like you used g_type_unique
>     instead of b_type_unique on type 'BonoboObject'

...it became pretty obvious that BonoboObject cannot be instantiated 
directly as I tried to do.  It would have been even nicer for that to be 
documented explicitly somewhere, but there you have it.  BonoboObject is 
in practice abstract and must be subclassed.

Creating a trivial BonoboObject subclass fixed the above warning as well 
as the activation server registration problem.  I'm down to just one 
diagnostic message:

>     Bonobo-WARNING **: Leaked a total of 1 refs to 1 bonobo object(s)

I'm not sure how to deal with cleanup properly.  I've tried several 
variations on the theme:

   1. Call g_object_unref() on my BonoboObject subclass.  Call
      bonobo_activation_unregister_active_server() from the subclass's
      instance finalization method.  Yields the following errors:

      (process:7202): Bonobo-WARNING **: Leaked a total of 1 refs to 1
      bonobo object(s)

      [start of call to instance finalization method]

      ** ERROR **: file poa.c: line 779 (ORBit_POA_activate_object):
      assertion failed: ((poa->life_flags & ORBit_LifeF_DeactivateDo) ==
      0)

      aborting...

   2. Call bonobo_activation_unregister_active_server() explicitly first.
      Then call g_object_unref() on my BonoboObject subclass.  Do nothing
      interesting in the subclass's finalization method except chain up
      to the superclass's finalization method.  Object is *not* finalized
      immediately after the g_object_unref() call.  The following errors
      appear later on:

      [start of call to bonobo_debug_shutdown()]

      (process:31843): Bonobo-WARNING **: Leaked a total of 1 refs to 1
      bonobo object(s)

      [start of call to instance finalization method]

      Bonobo-ERROR **: g_object_unreffing a bonobo_object that still has
      1 refs

      aborting...

How is one supposed to unregister and finalize a server?  Obviously 
whatever I'm trying isn't right.