Re: critical error in bonobo_object_unref(): assertion `ao != NULL' failed



A Ter, 2003-09-09 às 04:17, Ben Liblit escreveu:
> Michael Meeks wrote:
> > 	If you bin the auto_exit_unref you should get the behavior you're
> > expecting - although, it's prolly best to have an explicit 'dispose' or
> > somesuch on the server to tell it to shutdown, so the remote client
> > doesn't free something to which you still hold a local pointer
> > (*server).
> 
> I'm still stuck on this.  The behavior I want is for the server to start 
> when any client activates it, and for the server to remain active as 
> long as it has at least one client.  When the last client exits, the 
> server should exit too.  And I'm trying to do this without a factory.
> 
> I've just got a trivial BonoboObject subclass with no additional CORBA 
> interfaces beyond Bonobo::Unknown.  In the client, I activate the server 
> using a fixed, hard-coded IID, sleep for a while, then release:
> 
>     server = bonobo_activation_activate("iid == '...'", 0, 0, 0, 0);
>     sleep(10);
>     bonobo_object_release_unref(server, 0);
> 
> In the server, if I hand my BonoboObject subclass instance off to 
> bonobo_running_context_auto_exit_unref(), then as soon as the first 
> client exits, the server does the following:
> 
>      1. Reports "assertion `ao != NULL' failed".
>      2. Finalizes and destroys the server object.
>      3. Returns from bonobo_main().
> 
> If I follow Michael's suggestion and omit the call to 
> bonobo_running_context_auto_exit_unref(), then as soon as the first 
> client exits,the server does the following:
> 
>      1. Finalizes and destroys the server object.
> 
> No assertion failure, but also no main loop exit as desired.
> 
> Note that both approaches share a more critical flaw: the server object 
> is destroyed while it still has live clients.  For some reason the 
> server seems to have no idea that it has gotten a second client.  Any 
> client's call to bonobo_object_release_unref() is enough to finalize the 
> whole server even if other clients are still running.  Of course, if 
> clients don't call bonobo_object_release_unref() at all, then the server 
> lives on forever, which is also wrong.

  I don't really know for sure, but I *think* that
bonobo_activation_activate() returns either a new reference, if the
server wasn't running, or a shared reference if it was already running.

  If my suspicion is correct, then you should be ref()ing the returned
object if it was already active, and always unref.  Problem is how to
know if an object was already active before you tried to activate it.

  Michael, if this is true, then I think we should correct this
behaviour in gnome 2.5, if we are allowed to do that (or gnome 3 if not
:( ).  There is that rule (a wise rule for many reasons) that states
that functions that return objects should always return a new reference
to be owned by the caller.

  I have a feeling all this is caused from the old OAF code, where it
could activate non-Bonobo::Unknown objects, and so it couldn't handle
reference counting correctly.

  I have a feeling that the unique application code will suffer because
of this "property" as well.

> 
> Is there any way to get the semantics I want without using a factory? 
> Bonobo::Unknown is supposed to provide reference counting, so I'm 
> baffled as to why this doesn't work for a simple, single-instance 
> server.  {sigh}
> 
> Help?
> 
> _______________________________________________
> gnome-components-list mailing list
> gnome-components-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-components-list
-- 
Gustavo João Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]