shithub: qk1

Download patch

ref: c93600e9102e4748e54322729651b2371ced90d0
parent: d0ff488eafb8de6e1624e932fd1233f3d6973226
author: Konstantinn Bonnet <[email protected]>
date: Sun Mar 15 09:32:33 EDT 2015

fix Rendez lockups on crash

kill sproc as well as kproc and mproc.
also some small cleanups.

--- a/in_9.c
+++ b/in_9.c
@@ -37,13 +37,9 @@
 	Kev ev;
 	int r;
 
-	/* FIXME: sloppy */
 	if(oldm_windowed != m_windowed.value){
 		oldm_windowed = m_windowed.value;
-		if(!m_windowed.value)
-			IN_Grabm(0);
-		else
-			IN_Grabm(1);
+		IN_Grabm(m_windowed.value);
 	}
 
 	while((r = nbrecv(kchan, &ev)) > 0)
@@ -230,7 +226,7 @@
 
 			mouse_x += x;
 			mouse_y += y;
-			if(m_windowed.value && (x != 0.0 ||  y != 0.0))
+			if(x != 0.0 ||  y != 0.0)
 				fprint(fd, "m%d %d", center.x, center.y);
 
 			mouse_buttonstate = b&1 | (b&2)<<1 | (b&4)>>1;
@@ -277,25 +273,15 @@
 	mouseon = 0;
 }
 
-void sucks (void *, char *note)
-{
-	if(!strncmp(note, "sys:", 4))
-		IN_Shutdown();
-	noted(NDFLT);
-}
-
 void IN_Init (void)
 {
 	Cvar_RegisterVariable(&m_windowed);
 	Cvar_RegisterVariable(&m_filter);
-	notify(sucks);
 	kchan = chancreate(sizeof(Kev), Nbuf);
 	if((ktid = proccreate(kproc, nil, 8192)) < 0)
 		sysfatal("proccreate kproc: %r");
 	if(COM_CheckParm("-nomouse"))
 		return;
-	if(m_windowed.value)
-		IN_Grabm(1);
 	if((mtid = proccreate(mproc, nil, 8192)) < 0)
 		sysfatal("proccreate mproc: %r");
 	mouse_x = mouse_y = 0.0;
--- a/snd_9.c
+++ b/snd_9.c
@@ -60,7 +60,6 @@
 	if(COM_CheckParm("-sndmono") != 0)
 		shm->channels = 1;
 
-	//shm->samples = info.fragstotal * info.fragsize / (shm->samplebits/8);
 	shm->samples = 4096;
 	shm->submission_chunk = 1;
 
--- a/sys_9.c
+++ b/sys_9.c
@@ -193,6 +193,15 @@
 {
 }
 
+void croak (void *, char *note)
+{
+	if(!strncmp(note, "sys:", 4)){
+		IN_Shutdown();
+		SNDDMA_Shutdown();
+	}
+	noted(NDFLT);
+}
+
 void threadmain (int c, char **v)
 {
 	static char basedir[1024];
@@ -207,6 +216,7 @@
 
 	/* ignore fp exceptions (bad), rendering shit assumes they are */
 	setfcr(getfcr() & ~(FPOVFL|FPUNFL|FPINVAL|FPZDIV));	/* FIXME */
+	notify(croak);
 
 	COM_InitArgv(c, v);
 	parms.argc = com_argc;