From 8752f8d229e67221a6178e0cc4cc888b6e8c292e Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Wed, 5 Jun 2013 22:06:09 +0200 Subject: [PATCH] Retain parameters for delayed calls within the GLib mainloop --- src/gui/gtk/OFObject+GLibThread.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 -- 2.39.5