Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.4.1
-
None
Description
Run the attached file via qmlscene on a 2 monitor setup, place window on screen, then remove that screen. App will assert in __cxa_pure_virtual ()
Reason is the screen attached property reacts to a screen remove, and compares the new monitor against the old monitor
screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch()
all of this is called from a signal emitted in the destructor of physicalDotsPerInch, and physicalDotsPerInch is a virtual method of QPlatformScreen.
Calling a virtual method after the destructor won't use dynamic dispatch so will call the base QPlatformTheme and not the dervied QXCBPlatformScreen
(super reduced backtrace)
#5 0x00007ffff55e39df in __cxa_pure_virtual ()
#8 0x00007ffff6a9656a in QScreen::physicalDotsPerInch (this=0x43f720)
#9 0x00007ffff7ba14af in QQuickScreenAttached::screenChang
#27 0x00007ffff6a96360 in QScreen::~QScreen (this=0x43f720,
the screen object at #8 and #27 are the same instance
As I see it there are 2 options:
- patch screen attached property to not look at oldScreen
It's called so infrequently we could just emit regardless of whether the value has really changed, or we can cache the values.
- change QPlatformTheme to have an explicit screen removed signal before removal.
This probably means changing every QPA.
Downstream bug report in KDE: https://bugs.kde.org/show_bug.cgi?id=345544