Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
2.16.04 - Spring'16
-
None
Description
<div><p>If the client window is maximised and then you switch to fullscreen a LockRecursionException is thrown at <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/ScreenManagement/ScreenManager.cs#L477">ScreenControl.ExecuteWithTempReleasedResources</a> when trying to lock the GraphicsDevice.RenderAndResourceAccessLock.</p>
<p>It's caused by the call to StartUI <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L547">here</a> eventually leading to <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L1030-L1031">OnSizeChanged</a> calling <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L336">AdaptToSize</a> which recursively calls StartUI.</p>
<p>The exception doesn't occur when switching to fullscreen from a normal (non-maximised) window because the window states are equal (fullscreen's window state is also FormWindowState.Normal), so AdaptToSize isn't called because of the check in OnSizeChanged.</p>
<p>To fix I added a check for IsFullscreen in OnSizeChanged. This should be safe because its the same code path as switching from a normal window to fullscreen</p>
</div>
<p>It's caused by the call to StartUI <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L547">here</a> eventually leading to <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L1030-L1031">OnSizeChanged</a> calling <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L336">AdaptToSize</a> which recursively calls StartUI.</p>
<p>The exception doesn't occur when switching to fullscreen from a normal (non-maximised) window because the window states are equal (fullscreen's window state is also FormWindowState.Normal), so AdaptToSize isn't called because of the check in OnSizeChanged.</p>
<p>To fix I added a check for IsFullscreen in OnSizeChanged. This should be safe because its the same code path as switching from a normal window to fullscreen</p>
</div>