# HG changeset patch # User Jason Rumney # Date 1184164941 0 # Node ID f9eb7f243bdcc97da5d62c9fe6ba57aabdfbe930 # Parent 1f50b1fcfba3d1f661519936c01eb7b56d004a8f (w32_msg_pump) : Initialize COM. (w32_msg_pump) : Uninitialize COM. diff -r 1f50b1fcfba3 -r f9eb7f243bdc src/w32fns.c --- a/src/w32fns.c Wed Jul 11 14:41:44 2007 +0000 +++ b/src/w32fns.c Wed Jul 11 14:42:21 2007 +0000 @@ -52,6 +52,7 @@ #include #include #include +#include #include #define FILE_NAME_TEXT_FIELD edt1 @@ -2514,6 +2515,13 @@ /* Produced by complete_deferred_msg; just ignore. */ break; case WM_EMACS_CREATEWINDOW: + /* Initialize COM for this window. Even though we don't use it, + some third party shell extensions can cause it to be used in + system dialogs, which causes a crash if it is not initialized. + This is a known bug in Windows, which was fixed long ago, but + the patch for XP is not publically available until XP SP3, + and older versions will never be patched. */ + CoInitialize (NULL); w32_createwindow ((struct frame *) msg.wParam); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) abort (); @@ -3660,6 +3668,10 @@ my_post_msg (&wmsg, hwnd, msg, wParam, lParam); goto dflt; + case WM_DESTROY: + CoUninitialize (); + return 0; + case WM_CLOSE: wmsg.dwModifiers = w32_get_modifiers (); my_post_msg (&wmsg, hwnd, msg, wParam, lParam);