That's just the lovely way windows handles a "segfault". Gotta be really
authorBruce Momjian <bruce@momjian.us>
Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 1 Nov 2004 19:21:50 +0000 (19:21 +0000)
interesting for MS to catch all those dumps...

Anyway. Oops. Seems I ran my regression tests with the old psql, and
just managed to update the backend, when I tested that patch. Turns out
there are codepaths where we'd access the Critical Section before it was
initialized. Attached patch breaks the initializeation off to a separate
part and adds that one to a much earlier position in the program.

Magnus Hagander

src/bin/psql/common.c
src/bin/psql/common.h
src/bin/psql/startup.c

index d0b1c3f8e1d86f5e181c4fefed186c7b2d3f0e17..2097c808e60e585163b5868b29ec4d676be73209 100644 (file)
@@ -307,9 +307,14 @@ consoleHandler(DWORD dwCtrlType)
 }
 
 void
-setup_cancel_handler(void)
+setup_win32_locks(void)
 {
        InitializeCriticalSection(&cancelConnLock);
+}
+
+void
+setup_cancel_handler(void)
+{
        SetConsoleCtrlHandler(consoleHandler, TRUE);
 }
 
index d2ec4bfe961035346536087b9e23c30674f8285f..772739820e1c0a0e8c852e962c9d9ccd90d70e7a 100644 (file)
@@ -49,6 +49,7 @@ extern void ResetCancelConn(void);
 #ifndef WIN32
 extern void handle_sigint(SIGNAL_ARGS);
 #else
+extern void setup_win32_locks(void);
 extern void setup_cancel_handler(void);
 #endif
 
index 6af5d053514fc0c1aa5ca185e3f3b786fbcecbc0..e3293364921d8975db98fac8b58fa61c4e90274a 100644 (file)
@@ -121,6 +121,7 @@ main(int argc, char *argv[])
 
 #ifdef WIN32
        setvbuf(stderr, NULL, _IONBF, 0);
+       setup_win32_locks();
 #endif
        pset.cur_cmd_source = stdin;
        pset.cur_cmd_interactive = false;