# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1299535789 0 # Node ID b52f1d4a60dd1427f5030e36552ab0e6d65e78bb # Parent 5dde8d34bc6918a7108c366acb05adcd43ab60a4 Fixes for timers not working properly. Includes commented out test container code for threadsafety. diff -r 5dde8d34bc69 -r b52f1d4a60dd mac/dw.m --- a/mac/dw.m Thu Mar 03 14:49:30 2011 +0000 +++ b/mac/dw.m Mon Mar 07 22:09:49 2011 +0000 @@ -1110,13 +1110,13 @@ /* This function adds a signal handler callback into the linked list. */ -void _new_signal(ULONG message, HWND window, int id, void *signalfunction, void *data) +void _new_signal(ULONG message, HWND window, int msgid, void *signalfunction, void *data) { SignalHandler *new = malloc(sizeof(SignalHandler)); new->message = message; new->window = window; - new->id = id; + new->id = msgid; new->signalfunction = signalfunction; new->data = data; new->next = NULL; @@ -1130,7 +1130,7 @@ { if(tmp->message == message && tmp->window == window && - tmp->id == id && + tmp->id == msgid && tmp->signalfunction == signalfunction) { tmp->data = data; @@ -2597,6 +2597,9 @@ NSArray *newrow = [NSArray arrayWithObject:nstr]; [cont addRow:newrow]; + /*[cont performSelectorOnMainThread:@selector(addRow:) + withObject:newrow + waitUntilDone:YES];*/ [cont reloadData]; [newrow release]; @@ -5941,7 +5944,7 @@ if(sigfunc && !DWTimers[z]) { NSTimeInterval seconds = (double)interval / 1000.0; - NSTimer *thistimer = DWTimers[z] = [NSTimer timerWithTimeInterval:seconds target:DWHandler selector:@selector(runTimer:) userInfo:nil repeats:YES]; + NSTimer *thistimer = DWTimers[z] = [NSTimer scheduledTimerWithTimeInterval:seconds target:DWHandler selector:@selector(runTimer:) userInfo:nil repeats:YES]; _new_signal(0, thistimer, z+1, sigfunc, data); return z+1; } @@ -5965,11 +5968,11 @@ thistimer = DWTimers[timerid-1]; DWTimers[timerid-1] = nil; - [thistimer release]; + [thistimer invalidate]; while(tmp) { - if(tmp->id == (timerid-1) && tmp->window == thistimer) + if(tmp->id == timerid && tmp->window == thistimer) { if(prev) {