Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-8666

static call to QIcon::fromTheme() resulting in application crash

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 4.6.3
    • 4.6.0
    • GUI: Look'n'Feel
    • None
    • Ubuntu Linux
      Qt 4.6.0
      kernel : 2.6.31-16-generic
      GNOME : 2.28.1
      GCC version : 4.4.1 (x86_64-linux-gnu)
    • 7727a4355876607a1a022ff54e2570dae883f79c

      A problem exists when an attempt is made to call the fromTheme() method of the QIcon class as a static invocation of a singleton.
      E.g.

      //header: staticicontest.h
      class StaticIconTest : public QMainWindow
      {
          Q_OBJECT
      public:
          StaticIconTest(QWidget *parent = 0);
          ~StaticIconTest();
      private:
          static const QIcon staticIcon;
      };
      //source: staticicontest.cpp
      #include "staticicontest.h"
      const QIcon StaticIconTest::staticIcon = QIcon::fromTheme("filenew");
      

      My debugger reports the problem at line 89 of qguiplatformplugin.cpp at a switch statement:
      switch(X11->desktopEnvironment)
      Perhaps at startup time the X11 object is not yet initialized and is not ready for the call to "fromTheme".
      If I made the QIcon non-static, it is able to be initialized as a const in the constructor's initialization list, so I do believe it is the timing of the call, however, I am certainly no expert of the Qt backend.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            bachewii Jens
            schapman Sandy Chapman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes