title: Why does Qt crash when loading a window icon?
body: <p>The following application crashes on <code>mainWindow-&gt;show();</code></p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QFrame&gt;
  #include &lt;QPixmap&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      Q_INIT_RESOURCE(resources);
  
      QPixmap pix;
      pix.load(":/resources/images/app/icon_glow.png");
  
      QFrame *mainWindow = new QFrame;
      mainWindow-&gt;setWindowIcon(QIcon(pix));
      mainWindow-&gt;show();
  
      return a.exec();
  }
  </code></pre>
  
  <p>With the <code>mainWindow-&gt;setWindowIcon(QIcon(pix));</code> commented out, everything works. Otherwise, the backtrace (SEGFAULT, trying to dereference 0x8; seems like a missing nullptr check somewhere) is:</p>
  
  <pre><code>0   ??  /usr/local/Qt32/5.3/gcc/plugins/platforms/libqxcb.so        0xf4991138  
  1   ??  /usr/local/Qt32/5.3/gcc/plugins/platforms/libqxcb.so        0xf4982d4c  
  2   ??  /usr/local/Qt32/5.3/gcc/plugins/platforms/libqxcb.so        0xf498e7e3  
  3   ??  /usr/local/Qt32/5.3/gcc/plugins/platforms/libqxcb.so        0xf498f0f4  
  4   QWindowPrivate::applyCursor()   /usr/local/Qt32/5.3/gcc/lib/libQt5Gui.so.5      0xf7517942  
  5   QWindowPrivate::setCursor(QCursor const*)   /usr/local/Qt32/5.3/gcc/lib/libQt5Gui.so.5      0xf75179f7  
  6   QWindow::setCursor(QCursor const&amp;)  /usr/local/Qt32/5.3/gcc/lib/libQt5Gui.so.5      0xf7517b16  
  7   ??  /usr/local/Qt32/5.3/gcc/lib/libQt5Widgets.so.5      0xf7ad5d65  
  8   QWidgetPrivate::show_sys()  /usr/local/Qt32/5.3/gcc/lib/libQt5Widgets.so.5      0xf7ad60b6  
  9   QWidgetPrivate::show_helper()   /usr/local/Qt32/5.3/gcc/lib/libQt5Widgets.so.5      0xf7abab35  
  10  QWidget::setVisible(bool)   /usr/local/Qt32/5.3/gcc/lib/libQt5Widgets.so.5      0xf7abb005  
  11  QWidget::show() /usr/local/Qt32/5.3/gcc/lib/libQt5Widgets.so.5      0xf7aad77e  
  12  main    main.cpp    17  0x804a21f   
  </code></pre>
  
  <p>I tried loading the resource as follows:</p>
  
  <pre><code>QLabel *mainLabel = new QLabel;
  mainLabel-&gt;setPixmap(pix);
  mainLabel-&gt;show();
  </code></pre>
  
  <p>That works without a problem. Any help is greatly appreciated. Ubuntu 14.04 x64, compiled 32 bit, Qt 5.3</p>
  
  <p>UPDATE: I reinstalled ubuntu-desktop (i reverted the desktop from 32 bit to 64 bit) and now I get an error:</p>
  
  <pre><code>The X11 connection broke: Maximum allowed requested length exceeded (code 4)
  XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
        after 409 requests (409 known processed) with 0 events remaining.
  </code></pre>