changeset 688:b52f1d4a60dd

Fixes for timers not working properly. Includes commented out test container code for threadsafety.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 07 Mar 2011 22:09:49 +0000
parents 5dde8d34bc69
children 4199730e9889
files mac/dw.m
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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)
 			{