From 9b3163c00bdb8d406b864f7a1282b5770d953425 Mon Sep 17 00:00:00 2001 From: runge Date: Wed, 11 Jan 2006 19:56:10 +0000 Subject: logMutex needs to be initialized too; in rfbDefaultLog. --- libvncserver/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'libvncserver') diff --git a/libvncserver/main.c b/libvncserver/main.c index 51f9f2f..00b71be 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -38,6 +38,8 @@ #include #include +static int extMutex_initialized = 0; +static int logMutex_initialized = 0; #ifdef LIBVNCSERVER_HAVE_LIBPTHREAD static MUTEX(logMutex); static MUTEX(extMutex); @@ -61,7 +63,6 @@ void rfbRegisterProtocolExtension(rfbProtocolExtension* extension) { rfbProtocolExtension* last; - static int extMutex_initialized = 0; if (! extMutex_initialized) { INIT_MUTEX(extMutex); @@ -152,6 +153,11 @@ rfbDefaultLog(const char *format, ...) if(!rfbEnableLogging) return; + if (! logMutex_initialized) { + INIT_MUTEX(logMutex); + logMutex_initialized = 1; + } + LOCK(logMutex); va_start(args, format); @@ -654,7 +660,11 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, { rfbScreenInfoPtr screen=calloc(sizeof(rfbScreenInfo),1); - INIT_MUTEX(logMutex); + if (! logMutex_initialized) { + INIT_MUTEX(logMutex); + logMutex_initialized = 1; + } + if(width&3) rfbErr("WARNING: Width (%d) is not a multiple of 4. VncViewer has problems with that.\n",width); -- cgit v1.2.1