Odd valgrind error in imm.c, possible fix
Dan Kegel
dank at kegel.com
Sun Jul 6 23:51:03 CDT 2008
Today a test got stuck, and I had to kill wineserver.
After that, lots of tests seem to have the same
error:
+ Invalid read of size 4
+ at IMM_FreeThreadData (imm.c:233)
+ by DllMain (imm.c:385)
+ by __wine_spec_dll_entry (dll_entry.c:40)
+ by (within /home/dank/wine-git/dlls/ntdll/ntdll.dll.so)
+ by MODULE_InitDLL (loader.c:910)
+ by process_detach (loader.c:1081)
+ by LdrShutdownProcess (loader.c:2143)
+ by ExitProcess (process.c:2101)
+ by service_run_main_thread (service.c:604)
+ by StartServiceCtrlDispatcherW (service.c:703)
+ by wmain (device.c:287)
+ Address 0x0 is not stack'd, malloc'd or (recently) free'd
Presumably this is because killing wineserver also killed
the background notepad I run to keep from having
to valgrind wineboot etc. over and over again.
If the immediate cause is something like
imm32's DllMain getting called with DLL_PROCESS_DETACH
after being called with DLL_THREAD_DETACH, the following
patch might be a sensible fix. Is it?
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
index 94b7752..bcd11f1 100644
--- a/dlls/imm32/imm.c
+++ b/dlls/imm32/imm.c
@@ -230,10 +230,13 @@ static void IMM_InitThreadData(void)
static void IMM_FreeThreadData(void)
{
IMMThreadData* data = TlsGetValue(tlsIndex);
- IMM_DestroyContext(data->defaultContext);
- DestroyWindow(data->hwndDefault);
- HeapFree(GetProcessHeap(),0,data);
- TRACE("Thread Data Destroyed\n");
+ if (data)
+ {
+ IMM_DestroyContext(data->defaultContext);
+ DestroyWindow(data->hwndDefault);
+ HeapFree(GetProcessHeap(),0,data);
+ TRACE("Thread Data Destroyed\n");
+ }
}
static HMODULE LoadDefaultWineIME(void)
More information about the wine-devel
mailing list