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



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.

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?




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