From: Florian Zeitz Date: Wed, 5 Jun 2013 20:06:09 +0000 (+0200) Subject: Retain parameters for delayed calls within the GLib mainloop X-Git-Url: https://git.babelmonkeys.de/?a=commitdiff_plain;h=8752f8d229e67221a6178e0cc4cc888b6e8c292e;p=jubjub.git Retain parameters for delayed calls within the GLib mainloop --- diff --git a/src/gui/gtk/OFObject+GLibThread.m b/src/gui/gtk/OFObject+GLibThread.m index 4fe6bce..99d8255 100644 --- a/src/gui/gtk/OFObject+GLibThread.m +++ b/src/gui/gtk/OFObject+GLibThread.m @@ -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