[PreviewHandlers]Check for Disposed state when updating window bounds (#33373)

* Fixed Previewer production crash with an ObjectDisposedException

* Bumped MSBuildCacheCacheUniverse
This commit is contained in:
Ani 2024-06-16 17:32:33 +02:00 committed by GitHub
parent cdf5677eb9
commit deb6234d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -120,6 +120,12 @@ namespace Common
/// </summary>
public void UpdateWindowBounds(IntPtr hwnd, Rectangle newBounds)
{
if (this.Disposing || this.IsDisposed)
{
// For unclear reasons, this can be called when handling an error and the form has already been disposed.
return;
}
// We must set the WS_CHILD style to change the form to a control within the Explorer preview pane
int windowStyle = NativeMethods.GetWindowLong(Handle, gwlStyle);
if ((windowStyle & wsChild) == 0)