<?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>359758</bug_id>
          
          <creation_ts>2016-02-24 16:30:14 +0000</creation_ts>
          <short_desc>Dolphin crashes on exit when you specify the --icon command line parameter</short_desc>
          <delta_ts>2017-06-26 14:44:33 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>Frameworks and Libraries</classification>
          <product>frameworks-frameworkintegration</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>UPSTREAM</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="Wolfgang Bauer">wbauer1</reporter>
          <assigned_to name="kdelibs bugs">kdelibs-bugs-null</assigned_to>
          <cc>aspotashev</cc>
    
    <cc>cpigat242</cc>
    
    <cc>crglasoe</cc>
    
    <cc>elvis.angelaccio</cc>
    
    <cc>frank78ac</cc>
    
    <cc>inssecure</cc>
    
    <cc>montel</cc>
    
    <cc>mrbm74</cc>
    
    <cc>ohtf.xqr</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1578618</commentid>
    <comment_count>0</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2016-02-24 16:30:14 +0000</bug_when>
    <thetext>When you specify a window icon via the --icon parameter, dolphin crashes on exit with the following backtrace:
Application: dolphin (dolphin), signal: Segmentation fault
Using host libthread_db library &quot;/lib64/libthread_db.so.1&quot;.
[KCrash Handler]
#5  0x00007f96a8e963d4 in QHash&lt;QString, QHashDummyValue&gt;::deleteNode2(QHashData::Node*) (node=0x2514240) at /usr/include/qt5/QtCore/qbasicatomic.h:118
#6  0x00007f96a59a96b9 in QHashData::free_helper(void (*)(QHashData::Node*)) (this=0x20128b0, node_delete=0x7f96a8e963d0 &lt;QHash&lt;QString, QHashDummyValue&gt;::deleteNode2(QHashData::Node*)&gt;) at tools/qhash.cpp:491
#7  0x00007f96a8e9304d in KIconLoader::~KIconLoader() (this=&lt;optimized out&gt;, x=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qhash.h:621
#8  0x00007f96a8e9304d in KIconLoader::~KIconLoader() (this=0x1fdb170, __in_chrg=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qhash.h:342
#9  0x00007f96a8e9304d in KIconLoader::~KIconLoader() (this=0x1fdb170, __in_chrg=&lt;optimized out&gt;) at /usr/include/qt5/QtCore/qset.h:46
#10 0x00007f96a8e9304d in KIconLoader::~KIconLoader() (this=0x1fdb100, __in_chrg=&lt;optimized out&gt;) at /usr/src/debug/kiconthemes-5.19.0/src/kiconloader.cpp:147
#11 0x00007f96a8e9304d in KIconLoader::~KIconLoader() (this=0x7f96a90a8bb0 &lt;(anonymous namespace)::Q_QGS_globalIconLoader::innerFunction()::holder&gt;, __in_chrg=&lt;optimized out&gt;) at /usr/src/debug/kiconthemes-5.19.0/src/kiconloader.cpp:560
#12 0x00007f96a8e931e9 in (anonymous namespace)::Q_QGS_globalIconLoader::innerFunction()::Holder::~Holder() () at /usr/src/debug/kiconthemes-5.19.0/src/kiconloader.cpp:1624
#13 0x00007f96ab788b19 in __run_exit_handlers () at /lib64/libc.so.6
#14 0x00007f96ab788b65 in  () at /lib64/libc.so.6
#15 0x00007f96ab772b0c in __libc_start_main () at /lib64/libc.so.6
#16 0x00000000004007be in _start ()

This is with dolphin 15.12.2 (but it also happens with 15.12.1 and 15.12.0), Qt 5.5.1 and KDE Frameworks 5.19.0.

Reproducible: Always

Steps to Reproduce:
1. run e.g. &quot;dolphin --icon system-file-manager&quot;
2. close dolphin

Actual Results:  
Dolphin crashes with the mentioned backtrace.

Expected Results:  
Dolphin should exit cleanly.

I cannot reproduce the crash with any other KF5 application, so it seems to be something specific to dolphin.

Downgrading KDE Frameworks to 5.16.0 eliminates the crash, so it seems to be caused by some change in Frameworks between 5.16.0 and 5.19.0.
http://bugzilla.opensuse.org/show_bug.cgi?id=965514 would suggest it started with 5.18.0.

Only downgrading kiconthemes does not help though.

I&apos;ll try to find out which change exactly causes this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1579000</commentid>
    <comment_count>1</comment_count>
    <who name="Frank Reininghaus">frank78ac</who>
    <bug_when>2016-02-25 23:26:32 +0000</bug_when>
    <thetext>I can confirm this. I wonder if this is related to the recent QString -&gt; QStringLiteral changes.

It crashes in the destructor of KIconLoader&apos;s mAvailableIcons member, which is a QSet&lt;QString&gt;. Maybe the global static KIconLoader gets destoyed after the library that has the read-only QStringLiteral data has already been unloaded? In that case, it seems likely that the application will crash.

This makes me wonder if using QStringLiteral everywhere is really a good idea, since you never know if the QString will end up in a global static object at some point.

(In reply to Wolfgang Bauer from comment #0)
&gt; I&apos;ll try to find out which change exactly causes this.

That would be great!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1579003</commentid>
    <comment_count>2</comment_count>
      <attachid>97559</attachid>
    <who name="Frank Reininghaus">frank78ac</who>
    <bug_when>2016-02-26 00:02:24 +0000</bug_when>
    <thetext>Created attachment 97559
Add some debug output to KIconLoader</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1579005</commentid>
    <comment_count>3</comment_count>
    <who name="Frank Reininghaus">frank78ac</who>
    <bug_when>2016-02-26 00:12:25 +0000</bug_when>
    <thetext>I hacked some debug output into KIconLoader::hasIcon(const QString&amp;), to see the address of the internal data for each string, and to the KIconLoader destructor, where I first print the address of a string and then try to print the string itself.

This way, I found that the string &quot;dialog-close&quot; is the culprit, which I found with grep in frameworkintegration (src/kstyle/kstyle.cpp). It was made a QStringLiteral in this commit, which was made between 5.16 and 5.17:

https://quickgit.kde.org/?p=frameworkintegration.git&amp;a=commit&amp;h=7bbc6c98222eb6db988ed78fc334ad9eef0bb6fb

Reverting that commit fixes the crash for me.

I&apos;ll assign to frameworkintegration and CC Laurent, who committed this change. It seems that we have to think about whether

a) Everyone who makes QString -&gt; QStringLiteral replacements should be EXTREMELY careful (which is very difficult, since it is not always obvious if passing a QString to a function will result in the string being stored in a global static object),

b) Classes like KIconLoader, which are used as global static objects, should copy all strings that they get to the heap in order to prevent such crashes (which might also be difficult to do consistently).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1579072</commentid>
    <comment_count>4</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2016-02-26 14:09:10 +0000</bug_when>
    <thetext>(In reply to Frank Reininghaus from comment #3)
&gt; https://quickgit.kde.org/?p=frameworkintegration.
&gt; git&amp;a=commit&amp;h=7bbc6c98222eb6db988ed78fc334ad9eef0bb6fb
&gt; 
&gt; Reverting that commit fixes the crash for me.
Yes, I found this out myself too meanwhile.

Btw, I was wrong, sorry. The crash does not only happen with dolphin, but also other applications (not all though, I couldn&apos;t reproduce it with the ones I tried earlier).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1584985</commentid>
    <comment_count>5</comment_count>
    <who name="Alexander Potashev">aspotashev</who>
    <bug_when>2016-03-27 16:44:49 +0000</bug_when>
    <thetext>I&apos;ve just got a similar stacktrace from Lokalize-15.12.2 with KF 5.20.0.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1585024</commentid>
    <comment_count>6</comment_count>
    <who name="Alexander Potashev">aspotashev</who>
    <bug_when>2016-03-27 18:54:44 +0000</bug_when>
    <thetext>(In reply to Alexander Potashev from comment #5)
&gt; I&apos;ve just got a similar stacktrace from Lokalize-15.12.2 with KF 5.20.0.

=====

Application: lokalize (lokalize), signal: Segmentation fault
Using host libthread_db library &quot;/lib64/libthread_db.so.1&quot;.
[Current thread is 1 (Thread 0x7f2caa9f57c0 (LWP 8907))]

Thread 2 (Thread 0x7f2ca3fff700 (LWP 8909)):
#0  0x00007f2cb6c6baed in poll () from /lib64/libc.so.6
#1  0x00007f2cb22c3f14 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f2cb22c402c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f2cb7853dcb in QEventDispatcherGlib::processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /usr/lib64/libQt5Core.so.5
#4  0x00007f2cb77fe79b in QEventLoop::exec(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;) () from /usr/lib64/libQt5Core.so.5
#5  0x00007f2cb764da9c in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007f2cbbaad2c8 in QDBusConnectionManager::run() () from /usr/lib64/libQt5DBus.so.5
#7  0x00007f2cb7653430 in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#8  0x00007f2cb3d87314 in start_thread () from /lib64/libpthread.so.0
#9  0x00007f2cb6c746dd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f2caa9f57c0 (LWP 8907)):
[KCrash Handler]
#6  0x00007f2cb646bc64 in QHash&lt;QString, QHashDummyValue&gt;::deleteNode2(QHashData::Node*) () from /usr/lib64/libKF5IconThemes.so.5
#7  0x00007f2cb76abd19 in QHashData::free_helper(void (*)(QHashData::Node*)) () from /usr/lib64/libQt5Core.so.5
#8  0x00007f2cb6468b9c in KIconLoader::~KIconLoader() () from /usr/lib64/libKF5IconThemes.so.5
#9  0x00007f2cb6468bf9 in (anonymous namespace)::Q_QGS_globalIconLoader::innerFunction()::Holder::~Holder() () from /usr/lib64/libKF5IconThemes.so.5
#10 0x00007f2cb6bc38f9 in __run_exit_handlers () from /lib64/libc.so.6
#11 0x00007f2cb6bc3945 in exit () from /lib64/libc.so.6
#12 0x00007f2cb6bae85c in __libc_start_main () from /lib64/libc.so.6
#13 0x00000000004790f9 in _start ()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1618363</commentid>
    <comment_count>7</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2016-09-01 12:06:46 +0000</bug_when>
    <thetext>*** Bug 365794 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1618365</commentid>
    <comment_count>8</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2016-09-01 12:09:59 +0000</bug_when>
    <thetext>*** Bug 365163 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1627860</commentid>
    <comment_count>9</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2016-09-27 09:53:40 +0000</bug_when>
    <thetext>Sounds related to https://bugreports.qt.io/browse/QTBUG-50829.

In any case, the mentioned patch there fixes the crash for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1653169</commentid>
    <comment_count>10</comment_count>
    <who name="Christoph Feck">cfeck</who>
    <bug_when>2017-01-09 23:00:36 +0000</bug_when>
    <thetext>*** Bug 374733 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1653171</commentid>
    <comment_count>11</comment_count>
    <who name="Christoph Feck">cfeck</who>
    <bug_when>2017-01-09 23:01:19 +0000</bug_when>
    <thetext>*** Bug 369798 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1682886</commentid>
    <comment_count>12</comment_count>
    <who name="Elvis Angelaccio">elvis.angelaccio</who>
    <bug_when>2017-06-16 21:19:13 +0000</bug_when>
    <thetext>Isn&apos;t this fixed upstream? I can&apos;t reproduce with Qt 5.9</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1682950</commentid>
    <comment_count>13</comment_count>
    <who name="Wolfgang Bauer">wbauer1</who>
    <bug_when>2017-06-17 10:13:18 +0000</bug_when>
    <thetext>(In reply to Elvis Angelaccio from comment #12)
&gt; Isn&apos;t this fixed upstream? I can&apos;t reproduce with Qt 5.9

Yes, it should be fixed since 5.8.0 AFAIK.
5.6.2 does not have the fix AFAICS, I have no idea about the upcoming 5.6.3.

https://codereview.qt-project.org/#/c/140750/</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>97559</attachid>
            <date>2016-02-26 00:02:24 +0000</date>
            <delta_ts>2016-02-26 00:02:24 +0000</delta_ts>
            <desc>Add some debug output to KIconLoader</desc>
            <filename>debug-KIconLoader-crash.diff</filename>
            <type>text/plain</type>
            <size>1175</size>
            <attacher name="Frank Reininghaus">frank78ac</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3NyYy9raWNvbmxvYWRlci5jcHAgYi9zcmMva2ljb25sb2FkZXIuY3BwCmlu
ZGV4IDc1YWI0ODIuLjg0NDliNWQgMTAwNjQ0Ci0tLSBhL3NyYy9raWNvbmxvYWRlci5jcHAKKysr
IGIvc3JjL2tpY29ubG9hZGVyLmNwcApAQCAtMTQ1LDYgKzE0NSwxMiBAQCBwdWJsaWM6CiAKICAg
ICB+S0ljb25Mb2FkZXJQcml2YXRlKCkKICAgICB7CisgICAgICAgIGZvciAoY29uc3QgUVN0cmlu
ZyAmIHMgOiBtQXZhaWxhYmxlSWNvbnMpIHsKKyAgICAgICAgICAgIGNvbnN0IFFTdHJpbmcgKnRw
ID0gJnM7CisgICAgICAgICAgICBjb25zdCB2b2lkICogY29uc3QgKiBwdiA9IHJlaW50ZXJwcmV0
X2Nhc3Q8Y29uc3Qgdm9pZCogY29uc3QgKj4odHApOworICAgICAgICAgICAgcURlYnVnKCkgPDwg
IiEhPiB+S0ljb25Mb2FkZXJQcml2YXRlOiIgPDwgKnB2OyAvLyBwcmludCBqdXN0IHRoZSBhZGRy
ZXNzIGZvciBkZWJ1Z2dpbmcgLSB0aGUgbmV4dCBsaW5lIG1heSBjYXVzZSBhIGNyYXNoCisgICAg
ICAgICAgICBxRGVidWcoKSA8PCAiISE+IH5LSWNvbkxvYWRlclByaXZhdGU6IiA8PCAqcHYgPDwg
czsKKyAgICAgICAgfQogICAgICAgICBjbGVhcigpOwogICAgIH0KIApAQCAtMTYxNSw2ICsxNjIx
LDExIEBAIGJvb2wgS0ljb25Mb2FkZXI6Omhhc0ljb24oY29uc3QgUVN0cmluZyAmbmFtZSkgY29u
c3QKICAgICBib29sIGZvdW5kID0gZC0+bUF2YWlsYWJsZUljb25zLmNvbnRhaW5zKG5hbWUpOwog
ICAgIGlmICghZm91bmQgJiYgIWljb25QYXRoKG5hbWUsIEtJY29uTG9hZGVyOjpEZXNrdG9wLCBL
SWNvbkxvYWRlcjo6TWF0Y2hCZXN0KS5pc0VtcHR5KCkpIHsKICAgICAgICAgZm91bmQgPSB0cnVl
OworICAgICAgICBRU3RyaW5nIHRlc3QgPSBuYW1lOworICAgICAgICBRU3RyaW5nICp0cCA9ICZ0
ZXN0OworICAgICAgICBjb25zdCB2b2lkICoqIHB2ID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCB2
b2lkKio+KHRwKTsKKyAgICAgICAgcURlYnVnKCkgPDwgIiEhPiBpbnNlcnRpbmc6IiA8PCAqcHYg
PDwgbmFtZTsKKyAgICAgICAgLy9xRGVidWcoKSA8PCAiISE+IEtJTDo6aW5zZXJ0OiIgPDwgbmFt
ZS5pc0RldGFjaGVkKCkgPDwgbmFtZTsKICAgICAgICAgZC0+bUF2YWlsYWJsZUljb25zLmluc2Vy
dChuYW1lKTsKICAgICB9CiAgICAgcmV0dXJuIGZvdW5kOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>