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

Q3Action can be added to QMenu, but causes crash in destruction.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Out of scope
    • Affects Version/s: 4.6.2
    • Fix Version/s: 4.7.0
    • Labels:
      None
    • Environment:
      Linux (openSUSE 11.1)
      Qt 4.6.2
      GCC 4.3.2

      Description

      Although the documentation for Q3Action::addTo(QWidget*) states

      addTo() returns true if the action was added successfully and false otherwise. (If w is not a Q3ToolBar or Q3PopupMenu the action will not be added and false will be returned.)

      calling addTo() with a QMenu returns true, but later in the Q3Action destructor, a crash occurs.

      Here is a simple example which crashes upon closing.

      main.cpp
      #include <QtGui/QApplication>
      #include <QtGui/QMainWindow>
      #include <QtCore/QDebug>
      #include <QtGui/QMenu>
      #include <QtGui/QMenuBar>
      #include <Qt3Support/Q3Action>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QMainWindow w;
      
          QMenu *testMenu = w.menuBar()->addMenu("Test");
      
          Q3Action *action3 = new Q3Action(&w);
          action3->setText("A Q3Action");
          qDebug() << "adding Q3Action to QMenu:" << action3->addTo(testMenu);
      
          w.show();
      
          return a.exec();
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            Reporter:
            baysmith Bradley Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes