ui/cocoa/toolkit.m

changeset 868
be3df094f8db
parent 864
d39301e8f962
child 870
e167cf006213
equal deleted inserted replaced
867:83bb0dd7123f 868:be3df094f8db
176 } 176 }
177 177
178 @implementation UiAppCallback 178 @implementation UiAppCallback
179 179
180 - (id) initWithCallback:(ui_threadfunc)func userdata:(void*)userdata { 180 - (id) initWithCallback:(ui_threadfunc)func userdata:(void*)userdata {
181 self->callback = func; 181 _callback = func;
182 self->userdata = userdata; 182 _userdata = userdata;
183 return self; 183 return self;
184 } 184 }
185 185
186 - (void) callMainThread { 186 - (void) callMainThread {
187 [self performSelectorOnMainThread:@selector(mainThread:) 187 [self performSelectorOnMainThread:@selector(mainThread:)
188 withObject:nil 188 withObject:nil
189 waitUntilDone:NO]; 189 waitUntilDone:NO];
190 } 190 }
191 191
192 - (void) mainThread:(id)n { 192 - (void) mainThread:(id)n {
193 callback(userdata); 193 if(_callback) {
194 _callback(_userdata);
195 }
194 } 196 }
195 197
196 @end 198 @end
197 199
198 void ui_call_mainthread(ui_threadfunc tf, void* td) { 200 void ui_call_mainthread(ui_threadfunc tf, void* td) {

mercurial