ole32: CoRegisterMessageFilter shouldn't crash on an uninitialized apartment.
This commit is contained in:
parent
7c70f7f9b2
commit
241336c749
|
@ -2671,9 +2671,9 @@ HRESULT WINAPI CoRegisterMessageFilter(
|
|||
apt = COM_CurrentApt();
|
||||
|
||||
/* can't set a message filter in a multi-threaded apartment */
|
||||
if (apt->multi_threaded)
|
||||
if (!apt || apt->multi_threaded)
|
||||
{
|
||||
ERR("can't set message filter in MTA\n");
|
||||
WARN("can't set message filter in MTA or uninitialized apt\n");
|
||||
return CO_E_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -250,9 +250,10 @@ static void test_CoRegisterMessageFilter(void)
|
|||
HRESULT hr;
|
||||
IMessageFilter *prev_filter;
|
||||
|
||||
#if 0 /* crashes without an apartment! */
|
||||
hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
|
||||
#endif
|
||||
ok(hr == CO_E_NOT_SUPPORTED,
|
||||
"CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
|
||||
hr);
|
||||
|
||||
pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
prev_filter = (IMessageFilter *)0xdeadbeef;
|
||||
|
|
Loading…
Reference in New Issue