Re: PATCH/RFC: defer OLE apartment window creation
> >>This isn't thread-safe. It would also be better to make this an accessor > >>function for the win field of struct apartment and fix up all callers to > >>use this. I still have to verify on Windows whether this is what it does > >>or whether it does something funny with message loops. > >> > >> > > > >I lack the time and testing abilities to do this right now (and now > >on xmas break). > > > >Its just a quick hack to get Google Earth running. > > > > Can you update to latest CVS and confirm that this issue is fixed now? Works fine now, thanks! Ciao, Marcus
Re: PATCH/RFC: defer OLE apartment window creation
Marcus Meissner wrote: On Wed, Dec 21, 2005 at 02:55:14AM +, Robert Shearman wrote: Marcus Meissner wrote: @@ -257,6 +254,15 @@ return apt; } +void make_apartment_window(APARTMENT *apt) { +if (apt->win) return; +if (!(apt->model & COINIT_APARTMENTTHREADED)) +return; +apt->win = CreateWindowW(wszAptWinClass, NULL, 0, + 0, 0, 0, 0, + 0, 0, OLE32_hInstance, NULL); +} + This isn't thread-safe. It would also be better to make this an accessor function for the win field of struct apartment and fix up all callers to use this. I still have to verify on Windows whether this is what it does or whether it does something funny with message loops. I lack the time and testing abilities to do this right now (and now on xmas break). Its just a quick hack to get Google Earth running. Can you update to latest CVS and confirm that this issue is fixed now? -- Rob Shearman
Re: PATCH/RFC: defer OLE apartment window creation
On Wed, Dec 21, 2005 at 02:55:14AM +, Robert Shearman wrote: > Marcus Meissner wrote: > > >@@ -257,6 +254,15 @@ > >return apt; > >} > > > >+void make_apartment_window(APARTMENT *apt) { > >+if (apt->win) return; > >+if (!(apt->model & COINIT_APARTMENTTHREADED)) > >+return; > >+apt->win = CreateWindowW(wszAptWinClass, NULL, 0, > >+ 0, 0, 0, 0, > >+ 0, 0, OLE32_hInstance, NULL); > >+} > >+ > > > > This isn't thread-safe. It would also be better to make this an accessor > function for the win field of struct apartment and fix up all callers to > use this. I still have to verify on Windows whether this is what it does > or whether it does something funny with message loops. I lack the time and testing abilities to do this right now (and now on xmas break). Its just a quick hack to get Google Earth running. It is now up to showing the famous GL "black screen". :( (WINEDLLOVERRIDES=*usp10=n) Ciao, Marcus
PATCH/RFC: defer OLE apartment window creation
Hi, RFC ... since its likely not the clean way Robert wants. This defers the appartment window creation until it is actually need. Ciao, Marcus Changelog: Defer OLE apartment window creation until it is actually needed. Index: dlls/ole32/compobj.c === RCS file: /home/wine/wine/dlls/ole32/compobj.c,v retrieving revision 1.168 diff -u -r1.168 compobj.c --- dlls/ole32/compobj.c12 Nov 2005 19:11:21 - 1.168 +++ dlls/ole32/compobj.c20 Dec 2005 22:06:39 - @@ -236,9 +236,6 @@ { /* FIXME: should be randomly generated by in an RPC call to rpcss */ apt->oxid = ((OXID)GetCurrentProcessId() << 32) | GetCurrentThreadId(); -apt->win = CreateWindowW(wszAptWinClass, NULL, 0, - 0, 0, 0, 0, - 0, 0, OLE32_hInstance, NULL); } else { @@ -257,6 +254,15 @@ return apt; } +void make_apartment_window(APARTMENT *apt) { +if (apt->win) return; +if (!(apt->model & COINIT_APARTMENTTHREADED)) +return; +apt->win = CreateWindowW(wszAptWinClass, NULL, 0, + 0, 0, 0, 0, + 0, 0, OLE32_hInstance, NULL); +} + /* gets and existing apartment if one exists or otherwise creates an apartment * structure which stores OLE apartment-local information and stores a pointer * to it in the thread-local storage */ Index: dlls/ole32/compobj_private.h === RCS file: /home/wine/wine/dlls/ole32/compobj_private.h,v retrieving revision 1.60 diff -u -r1.60 compobj_private.h --- dlls/ole32/compobj_private.h28 Nov 2005 11:04:18 - 1.60 +++ dlls/ole32/compobj_private.h20 Dec 2005 22:06:39 - @@ -253,6 +253,8 @@ return COM_CurrentInfo()->apt; } +void make_apartment_window(APARTMENT *apt); + #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) /* helpers for debugging */ Index: dlls/ole32/rpc.c === RCS file: /home/wine/wine/dlls/ole32/rpc.c,v retrieving revision 1.72 diff -u -r1.72 rpc.c --- dlls/ole32/rpc.c19 Dec 2005 20:24:25 - 1.72 +++ dlls/ole32/rpc.c20 Dec 2005 22:06:39 - @@ -257,6 +257,7 @@ TRACE("Calling apartment thread 0x%08lx...\n", apt->tid); +if (!apt->win) make_apartment_window(apt); PostMessageW(apt->win, DM_EXECUTERPC, 0, (LPARAM)params); } else @@ -498,6 +499,7 @@ TRACE("Calling apartment thread 0x%08lx...\n", apt->tid); +if (!apt->win) make_apartment_window(apt); PostMessageW(apt->win, DM_EXECUTERPC, 0, (LPARAM)params); WaitForSingleObject(params->handle, INFINITE); CloseHandle(params->handle);