Fix handling display disconnection under wxMSW

Information about display cached in wxDisplayFactory::m_impls and in
wxDisplayFactoryMSW::m_displays could get out of sync after removing a
display from the system, resulting in failures when calling various
wxDisplay functions later.

To fix this, reuse InvalidateCache() to invalidate the cache in
wxDisplayFactoryMSW too, making it virtual in order to allow overriding
it there. Also call InvalidateCache() from wxDisplayFactoryMSW itself
instead of doing it from wxWindow, as this works even when the
application isn't showing any windows (and also keeps all
display-related code together).

Closes https://github.com/wxWidgets/wxWidgets/pull/1246
This commit is contained in:
dasimx
2019-03-28 21:47:41 +01:00
committed by Vadim Zeitlin
parent 15a68c9916
commit a15004fc5f
3 changed files with 10 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ public:
virtual int GetFromWindow(const wxWindow *window);
// Trigger recreation of wxDisplayImpl when they're needed the next time.
void InvalidateCache() { ClearImpls(); }
virtual void InvalidateCache() { ClearImpls(); }
protected:
// create a new display object