Uploaded image for project: 'MediaPortal 2'
  1. MediaPortal 2
  2. MP2-529

LockRecursionException when switching from maximised window to fullscreen

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • 2.16.04 - Spring'16
    • Skin Engine
    • 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&nbsp;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>&nbsp;eventually leading to <a href="https://github.com/MediaPortal/MediaPortal-2/blob/dev/MediaPortal/Source/UI/SkinEngine/GUI/MainForm.cs#L1030-L1031">OnSizeChanged</a>&nbsp;calling&nbsp;<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&nbsp;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>

      Attachments

        Activity

          People

            brownard Brownard
            brownard Brownard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: