<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>448474</bug_id>
          
          <creation_ts>2022-01-14 16:17:34 +0000</creation_ts>
          <short_desc>KWin crashed in KWin::DrmOutput::DrmOutput when plugging in an external HDMI screen</short_desc>
          <delta_ts>2022-01-18 21:37:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>wayland-generic</component>
          <version>git master</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nate Graham">nate</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/commit/24dc3abe918cde9007e19c4351e5778480f5bb75</cf_commitlink>
          <cf_versionfixedin>5.24</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2093682</commentid>
    <comment_count>0</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-14 16:17:34 +0000</bug_when>
    <thetext>I plugged in an external 27&quot; 1080p screen into my laptop&apos;s HDMI port and kwin_wayland immediately crashed:

#0  QVector&lt;KWin::DrmConnectorMode*&gt;::realloc(int, QFlags&lt;QArrayData::AllocationOption&gt;)
    (options=..., aalloc=&lt;optimized out&gt;, this=0x7ffeeaeb2798)
    at /usr/include/c++/11/bits/atomic_base.h:385
#1  QVector&lt;KWin::DrmConnectorMode*&gt;::detach() (this=0x7ffeeaeb2798)
    at /usr/include/qt5/QtCore/qvector.h:405
#2  QVector&lt;KWin::DrmConnectorMode*&gt;::detach() (this=0x7ffeeaeb2798)
    at /usr/include/qt5/QtCore/qvector.h:397
#3  QVector&lt;KWin::DrmConnectorMode*&gt;::data() (this=0x7ffeeaeb2798)
    at /usr/include/qt5/QtCore/qvector.h:134
#4  QVector&lt;KWin::DrmConnectorMode*&gt;::operator[](int) (i=-652783056, this=0x7ffeeaeb2798)
    at /usr/include/qt5/QtCore/qvector.h:458
#5  KWin::DrmOutput::getModes() const (this=&lt;optimized out&gt;)
    at /home/nate/kde/src/kwin/src/backends/drm/drm_output.cpp:190
#6  0x00007fcbc6768fa3 in KWin::DrmOutput::DrmOutput(KWin::DrmPipeline*) (this=
    0x71, pipeline=&lt;optimized out&gt;) at /home/nate/kde/src/kwin/src/backends/drm/drm_output.cpp:58
#7  0x00007fcbc67751cf in QTypedArrayData&lt;unsigned long&gt;::deallocate(QArrayData*)
    (data=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qarraydata.h:239
#8  QVector&lt;unsigned long&gt;::freeData(QTypedArrayData&lt;unsigned long&gt;*)
    (x=&lt;optimized out&gt;, this=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qvector.h:579
#9  QVector&lt;unsigned long&gt;::~QVector() (this=&lt;optimized out&gt;, __in_chrg=&lt;optimized out&gt;)
    at /usr/include/qt5/QtCore/qvector.h:73
#10 QVector&lt;unsigned long&gt;::~QVector() (this=0x20, __in_chrg=&lt;optimized out&gt;)
    at /usr/include/qt5/QtCore/qvector.h:73
#11 QMapNodeBase::callDestructorIfNecessary&lt;QVector&lt;unsigned long&gt; &gt;(QVector&lt;unsigned long&gt;&amp;)
    (t=...) at /usr/include/qt5/QtCore/qmap.h:100
#12 QMapNode&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::destroySubTree() (this=0x0)
    at /usr/include/qt5/QtCore/qmap.h:125
#13 QMapNode&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::doDestroySubTree(std::integral_constant&lt;bool, true&gt;) (this=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qmap.h:139
#14 QMapNode&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::destroySubTree() (this=&lt;optimized out&gt;)
    at /usr/include/qt5/QtCore/qmap.h:126
#15 QMapNode&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::doDestroySubTree(std::integral_constant&lt;bool, true&gt;) (this=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qmap.h:137
#16 QMapNode&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::destroySubTree() (this=&lt;optimized out&gt;)
    at /usr/include/qt5/QtCore/qmap.h:126
#17 QMapData&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::destroy() (this=0x12d8e60)
    at /usr/include/qt5/QtCore/qmap.h:249
#18 QMap&lt;unsigned int, QVector&lt;unsigned long&gt; &gt;::~QMap() (this=0x7, __in_chrg=&lt;optimized out&gt;)
    at /usr/include/qt5/QtCore/qmap.h:338
#19 KWin::DrmGpu::isFormatSupported(unsigned int) const (this=&lt;optimized out&gt;, drmFormat=20455624)
    at /home/nate/kde/src/kwin/src/backends/drm/drm_gpu.cpp:602</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2093696</commentid>
    <comment_count>1</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2022-01-14 16:46:59 +0000</bug_when>
    <thetext>Thanks for reminding me that that method can be completely removed now :)

Anyways, that looks like there&apos;s some deeper issue, with invalid memory accesses - that backtrace doesn&apos;t make any sense otherwise. The other half of the backtrace would be interesting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2093698</commentid>
    <comment_count>2</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-14 16:51:26 +0000</bug_when>
    <thetext>That was the whole thing. Is there anything else I can get?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2093732</commentid>
    <comment_count>3</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2022-01-14 17:43:28 +0000</bug_when>
    <thetext>You can maybe check the journalctl for any possible logging that happened before the crash... but if you can&apos;t reproduce it, that&apos;s all you can do. If you can reproduce it then you could attach gdb over ssh before it crashes and get a proper backtrace that way</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2094982</commentid>
    <comment_count>4</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2022-01-18 11:31:18 +0000</bug_when>
    <thetext>I think https://invent.kde.org/plasma/kwin/-/merge_requests/1905 may also fix this / the same bug caused this. Invalid memory accesses can do all sorts of weird stuff.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095181</commentid>
    <comment_count>5</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-18 20:57:07 +0000</bug_when>
    <thetext>OK, let me give it a try!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095189</commentid>
    <comment_count>6</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-18 21:16:14 +0000</bug_when>
    <thetext>Yep, that fixes it!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095197</commentid>
    <comment_count>7</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-18 21:36:36 +0000</bug_when>
    <thetext>Git commit e0a8fa778e3dce508695155c7d5a9a1e0bddd9f8 by Nate Graham, on behalf of Xaver Hugl.
Committed on 18/01/2022 at 21:36.
Pushed by ngraham into branch &apos;master&apos;.

backends/drm: fix output changes with the placeholder output

As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.
Related: bug 448454, bug 448697
FIXED-IN: 5.24

M  +7    -3    src/backends/drm/drm_backend.cpp

https://invent.kde.org/plasma/kwin/commit/e0a8fa778e3dce508695155c7d5a9a1e0bddd9f8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2095200</commentid>
    <comment_count>8</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-18 21:37:57 +0000</bug_when>
    <thetext>Git commit 24dc3abe918cde9007e19c4351e5778480f5bb75 by Nate Graham, on behalf of Xaver Hugl.
Committed on 18/01/2022 at 21:37.
Pushed by ngraham into branch &apos;Plasma/5.24&apos;.

backends/drm: fix output changes with the placeholder output

As the placeholder output gets added or removed in response to other outputs
getting enabled or disabled, the output list may change while iterating over
them and applying changes.
Related: bug 448454, bug 448697
FIXED-IN: 5.24


(cherry picked from commit e0a8fa778e3dce508695155c7d5a9a1e0bddd9f8)

M  +7    -3    src/backends/drm/drm_backend.cpp

https://invent.kde.org/plasma/kwin/commit/24dc3abe918cde9007e19c4351e5778480f5bb75</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>