зеркало из https://github.com/dotnet/winforms.git
fix: ContextMenuStrip leads to crash on W10 1607 (#3279)
This commit is contained in:
Родитель
e2ccd96a21
Коммит
fe51dd5bcf
|
@ -62,7 +62,11 @@ namespace System.Windows.Forms
|
||||||
!AreDpiAwarenessContextsEqual(originalAwareness, DPI_AWARENESS_CONTEXT.UNAWARE))
|
!AreDpiAwarenessContextsEqual(originalAwareness, DPI_AWARENESS_CONTEXT.UNAWARE))
|
||||||
{
|
{
|
||||||
originalAwareness = SetThreadDpiAwarenessContext(awareness);
|
originalAwareness = SetThreadDpiAwarenessContext(awareness);
|
||||||
dpiAwarenessScopeIsSet = true;
|
|
||||||
|
// As reported in https://github.com/dotnet/winforms/issues/2969
|
||||||
|
// under unknown conditions originalAwareness may remain 0 (which means the call failed)
|
||||||
|
// causing us to set dpiAwarenessScopeIsSet=true, which would lead to a crash when we attempt to dispose the scope.
|
||||||
|
dpiAwarenessScopeIsSet = originalAwareness != IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче