Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Fix crash when Kodi is moved to another monitor with different video adapter #19782

Merged
merged 1 commit into from May 22, 2021

Conversation

thexai
Copy link
Member

@thexai thexai commented May 22, 2021

Description

Fix crash when Kodi is moved to another monitor with different video adapter due to hardware changed.

Fixes #15295 (if is not already fixed by #19768)

Motivation and context

This is very similar to #19768. This time are different monitors and different video adapters.

How has this been tested?

System with internal video adapter Intel 630 and Nvidia adapter and is configured with two monitors (Intel primary and desktop extended to monitor 2 (Nvidia). Kodi is running on monitor 2 (Nvidia).

Changed Windows display settings to one monitor (Intel) while Kodi is running on Nvidia. Kodi switches at monitor 1 and when is restored full screen crashes.

The root cause is that method CWinSystemWin32DX::OnMove(int x, int y) is called two times:

Call 1
current_monitor = Nvidia
new_monitor = Intel
m_monitor = new_monitor; ---> at this time Kodi knows that is at Intel monitor. All right.

Call 2 (because Kodi interprets NULL monitor as new monitor again)
current_monitor = Intel
new_monitor = NULL
m_monitor = NULL; --> crash

Without fix crash by access to null pointer.
With fix is discarded this second call.

What is the effect on users?

Fix crash when Kodi switches from monitor due hardware config changed and new monitor is on another video adapter.

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kodi crashes with access violation when restoring full screen
2 participants