Summary: | Crash in KScreen::Output::isEnabled | ||
---|---|---|---|
Product: | [Plasma] plasmashell | Reporter: | Cristiano <gueroh> |
Component: | general | Assignee: | David Edmundson <kde> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | aspotashev, bshah, jacobnoori, kde, plasma-bugs, shamim.islam |
Priority: | NOR | Keywords: | drkonqi |
Version First Reported In: | 5.2.2 | ||
Target Milestone: | 1.0 | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Qt sends "screenRemoved" and "screenAdded" when renaming QScreen |
Description
Cristiano
2015-08-05 11:52:13 UTC
Had you just plugged in a monitor? *** Bug 360641 has been marked as a duplicate of this bug. *** I just made a little analysis and found that it may be a bug in Qt. Currently plasmashell (shellcorona.cpp) finds accordance between QScreen and KScreen::Output by property name(). You may see this in methods ShellCorona::outputToScreen or ShellCorona::screenToOutput: ... if (screen->name() == output->name()) ... Also if I open QScreen.h header, I see that property 'name' is constant: Q_PROPERTY(QString name READ name CONSTANT) But if I open the platform-specific implementation of QScreen, which is QXcbScreen, there is a method QXcbScreen::setOutputwhich changes inner property m_outputName and has the following TODO: // TODO: Send an event to the QScreen instance that the screen changed its name So in this place the QScreen changes its m_outputName and noone knows about it. This 'm_outputName' is the result which is returned as QScreen name() and it becomes inconsistent with shellcorona's data. After that ShellCorona loses correct names for QScreens and can't find correct KScreen::Output for existing QScreen, then outputForScreen returns empty pointer and the crash occurs while dereferencing it. I think we should elevate this bug to Qt guys. Maybe the combination of emitting existing signals screenRemoved and screenAdded will be enough to handle the problem. Also I made a small proof-of-concept app which prints all available screens with the code: qDebug() << "screens"; foreach (QScreen* screen, QGuiApplication::screens()) { qDebug() << " " << screen << " with name=" << screen->name() << " and platform screen=" << screen->handle(); } When I detach and external monitor and attach it again, I have the output (before detaching monitor, detached monitor, after attaching it back): screens: QScreen(0x23fcff0) with name= "HDMI1" and platform screen= 0x2401850 screens: QScreen(0x23fcff0) with name= "eDP1" and platform screen= 0x2401850 screens: QScreen(0x23fcff0) with name= "HDMI1" and platform screen= 0x2401850 It is evident from the output, that the pointer to QScreen object remains the same, but the name changes. If necessary, I will upload this app here, just let me know. Here is part of backtrace when the screen is renamed inside Qt: #2 0x00007ffff7f03c83 in QXcbScreen::setOutput (this=0x645290, outputId=outputId@entry=0, outputInfo=outputInfo@entry=0x0) at qxcbscreen.cpp:405 #3 0x00007ffff7ef2c27 in QXcbConnection::destroyScreen (this=this@entry=0x636e40, screen=screen@entry=0x645290) at qxcbconnection.cpp:336 #4 0x00007ffff7ef3d68 in QXcbConnection::updateScreens (this=this@entry=0x636e40, event=event@entry=0x7fffe4004300) at qxcbconnection.cpp:210 #5 0x00007ffff7ef48b3 in QXcbConnection::handleXcbEvent (this=this@entry=0x636e40, event=event@entry=0x7fffe4004300) at qxcbconnection.cpp:1160 The screen is converted into "fake screen" and then later reused for another output. In my case firstly "HDMI1" is renamed to ":0.0" (fake) and then after short time to "eDP1" (real). Created attachment 98256 [details] Qt sends "screenRemoved" and "screenAdded" when renaming QScreen I modified Qt sources so it sends "screenRemoved" when the screen is converted to "fake" and sends "screenAdded" when the screen is converted to normal. My crash disappeared. Also I made Ubuntu ppa with patched package for Ubuntu-xenial: https://launchpad.net/~xapienz/+archive/ubuntu/ppa. If anyone can confirm the fix, you are welcome :) Meanwhile, I will try to notify Qt team and propose them the solution. Hm, I'm sorry, seems I could find the solution only for the bug 360641 (which was marked as duplicate of this bug), but not this one. I looked into the sources of Qt 5.4.1 (which is used by reporter of thig bug) and didn't find the fact that QScreen may be renamed in that version of Qt. Anyway, I posted results of my analysis to Qt: https://bugreports.qt.io/browse/QTBUG-52375 *** Bug 362119 has been marked as a duplicate of this bug. *** Good analysis, thanks for the Qt report. This particular bug should be invalid in Plasma 5.7 as KScreen is no longer used in plasma-workspace *** Bug 365024 has been marked as a duplicate of this bug. *** I can confirm that after updating to Plasma 5.7 this bug no longer appears on my system. |