Re: [Vala] Simple Memory Management Issue



Luca,

(gdb) bt
#0  0x0068fac5 in ?? ()
#1  0x0804b687 in plug_plug_run (self=0x8057700, items=0x8057cc8)
    at /home/joseph/Documents/ada/csv/plugplug-interface.c:41
#2  0x0804b399 in _vala_main () at /home/joseph/Documents/ada/csv/main.c:631
#3  0x0804b405 in main (argc=1, argv=0xbffff4f4) at
/home/joseph/Documents/ada/csv/main.c:648


Line 41 in the C code is:
void plug_plug_run (PlugPlug* self, GeeArrayList* items) {
        PLUG_PLUG_GET_INTERFACE (self)->run (self, items);
}

Which leads to this:
#define PLUG_PLUG_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE
((obj), TYPE_PLUG_PLUG, PlugPlugIface))

I also tried changing:
var plugin = plugins[choice];
if (plugin != null) {
        plugin.run (items);
}

to

unowned PlugPlug plugin = (PlugPlug*) plugins[choice];
if (plugin != null) {
        plugin.run (items);
}

But it still crashes at the same point.
On Tue, Aug 16, 2011 at 8:06 AM, Luca Bruno <lethalman88 gmail com> wrote:
On Tue, Aug 16, 2011 at 06:53:34AM -0700, Joseph Montanez wrote:
I've been trying to get this to work but it keeps crashing :\. I don't
think I understand the memory model here.. "PlugPlug* plugin" is
suppose to allow me full control of the object. When I call "var
plugin = plugins[choice];" its not null... So after that I'm calling
"plugin.run" and it crashes. I've looked at the C code and saw when
its assigned to the hashmap it uses "PLUG_PLUG (plugin)" but when its
retrieved its not. Maybe that's my issue? but how would I even fix
that?

When you do var plugin = plugins[choice] the variable owns the plugin.

Can you please paste an useful back trace? You won't be able to track down
crashes without it.

--
http://www.debian.org - The Universal Operating System




-- 
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy



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