diff --git a/reactos/dll/win32/kernel32/client/synch.c b/reactos/dll/win32/kernel32/client/synch.c index 3d577fe2e2e..dede163c9a0 100644 --- a/reactos/dll/win32/kernel32/client/synch.c +++ b/reactos/dll/win32/kernel32/client/synch.c @@ -702,6 +702,9 @@ SleepEx(IN DWORD dwMilliseconds, errCode = NtDelayExecution((BOOLEAN)bAlertable, TimePtr); } while ((bAlertable) && (errCode == STATUS_ALERTED)); + + /* Cleanup the activation context */ + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); /* Return the correct code */ return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0; diff --git a/reactos/lib/rtl/actctx.c b/reactos/lib/rtl/actctx.c index 7984cf1e802..e607960033f 100644 --- a/reactos/lib/rtl/actctx.c +++ b/reactos/lib/rtl/actctx.c @@ -2832,7 +2832,10 @@ RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CON frame = &Frame->Frame; if (!frame) + { + DPRINT1("No top frame!\n"); RtlRaiseStatus( STATUS_SXS_INVALID_DEACTIVATION ); + } /* pop everything up to and including frame */ NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame->Previous;