Re: [PATCH] stop win32 crash when bringing down service

2000-12-19 Thread Doug MacEachern

applied, nice find!




[PATCH] stop win32 crash when bringing down service

2000-10-20 Thread John K. Sterling

it appears that the mp dso was being unloaded before the cleanups were
complete, causing a crash in cleanup_sv - ONLY when running as a
service.  still not sure why this happens, but this patch at least
eliminates the crash.  i believe this is only called before the process
comes down (nt service restart seems to bring the process down), so it
shouldn't really leak.

--- mod_perl.c_bk   Fri Oct 20 12:03:22 2000
+++ mod_perl.c  Fri Oct 20 12:58:52 2000
@@ -507,8 +507,20 @@
 
 static void mp_dso_unload(void *data) 
 { 
-
-array_header *librefs = xs_dl_librefs((pool *)data);
+array_header *librefs;
+#ifdef WIN32
+// This is here to stop a crash when bringing down
+// a service.  Apparently the dso is unloaded too early.
+// This if statement tests to see if we are running as a 
+// service. apache does the same
+// see apache's isProcessService() in service.c 
+if (AllocConsole())
+{
+FreeConsole();
+return;
+} 
+#endif
+librefs = xs_dl_librefs((pool *)data);
 perl_shutdown(NULL, NULL);
 unload_xs_so(librefs);