]> git.babelmonkeys.de Git - jubjub.git/commitdiff
Retain parameters for delayed calls within the GLib mainloop
authorFlorian Zeitz <florob@babelmonkeys.de>
Wed, 5 Jun 2013 20:06:09 +0000 (22:06 +0200)
committerFlorian Zeitz <florob@babelmonkeys.de>
Wed, 5 Jun 2013 20:06:09 +0000 (22:06 +0200)
src/gui/gtk/OFObject+GLibThread.m

index 4fe6bcec9b272e788f3a950d2dec8b0e1b95d294..99d8255c92b484479913d4dc7f3b830530c55d83 100644 (file)
@@ -35,6 +35,7 @@ static gboolean callback1(gpointer object)
        struct params1 *parm = object;
        [parm->object performSelector: parm->selector
                           withObject: parm->param];
+       [parm->param release];
        [parm->object freeMemory: parm];
        return FALSE;
 }
@@ -45,6 +46,8 @@ static gboolean callback2(gpointer object)
        [parm->object performSelector: parm->selector
                           withObject: parm->param1
                           withObject: parm->param2];
+       [parm->param1 release];
+       [parm->param2 release];
        [parm->object freeMemory: parm];
        return FALSE;
 }
@@ -64,7 +67,7 @@ static gboolean callback2(gpointer object)
        struct params1 *parm = [self allocMemoryWithSize: sizeof(*parm)];
        parm->object = self;
        parm->selector = selector;
-       parm->param = object;
+       parm->param = [object retain];
        g_idle_add(callback1, parm);
 }
 
@@ -75,8 +78,8 @@ static gboolean callback2(gpointer object)
        struct params2 *parm = [self allocMemoryWithSize: sizeof(*parm)];
        parm->object = self;
        parm->selector = selector;
-       parm->param1 = object1;
-       parm->param2 = object2;
+       parm->param1 = [object1 retain];
+       parm->param2 = [object2 retain];
        g_idle_add(callback2, parm);
 }
 @end