Re: Problem releasing ORB.



I could be wrong (it's been a while since I programmed in corba), but I
don't think you call CORBA_Exception_free on a stack-allocated object.

Jon

On Fri, 28 Feb 2003, Craig wrote:

>
> Hi, I'm having some problems running an example with ORBit2 (2.6.0)
>
> I have the following IDL.
>
> interface Thermostat
> {
>          short setTemperature(in long temp);
>          void setListener(in string ior);
> };
>
> And the following client code.
>
> #include "Thermostat.h"
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char** argv)
> {
>     Thermostat thermostat;
>
>     CORBA_Environment ev;
>     CORBA_ORB orb;
>
>     if ( argc != 2 )
>     {
>        printf("Expected argument\n");
>        return 1;
>     }
>
>     CORBA_exception_init(&ev);
>     orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev);
>
>     thermostat = CORBA_ORB_string_to_object(orb,
>                                             argv[1],
>                                             &ev);
>
>     Thermostat_setTemperature(thermostat,
>                               2,
>                               &ev);
>     Thermostat_setTemperature(thermostat,
>                               20,
>                               &ev);
>     Thermostat_setTemperature(thermostat,
>                               200,
>                               &ev);
>
>     printf("here-1\n");
>     fflush(stdout);
>     CORBA_Object_release(thermostat, &ev);
>     printf("here-2\n");
>     fflush(stdout);
>     CORBA_Object_release((CORBA_Object)orb, &ev);
>     printf("here-3\n");
>     fflush(stdout);
>     CORBA_exception_free(&ev);
>     printf("here-4\n");
>     fflush(stdout);
>     return 0;
> }
>
> When I run the program I get:
>
> here-1
> here-2
> here-3
> here-4
>
> ** ERROR **: file orbit-object.c: line 146 (do_unref): assertion
> failed: (robj->refs < ORBIT_REFCOUNT_MAX && robj->refs > 0)
> aborting...
> Aborted
>
>
> What's going on here? I've followed the examples online almost
> exactly....
>
> Also, all of the tests that come packaged with ORBit segfault.
>
> I have pkconfig-0.15, linc-1.0.1, glib-2.2.1, libIDL-0.8.0 and
> ORBit2-2.6.0.
> All compiled from scratch on Redhat 7.2 with gcc 2.96.
>
> Thanks for any help,
>
> -Craig
>
> P.S. I've figured is out, and it seems to come from the line where I
> release the ORB. I guess
> the question is why, and why do the examples release the ORB? :)
>
> P.P.S. I guess I'm just going to send this out because it's already
> been written and this may happen to someone else someday.
>
> _______________________________________________
> orbit-list mailing list
> orbit-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/orbit-list
>




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