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

Regression: context menu with submenu crashes on second open

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.3.0 RC1
    • 5.3.0 RC1
    • GUI: Look'n'Feel
    • None
    • OS X 10.9, qtbase/release (ee85cdee67d164315e52a05462b03fe7091cc26d)
    • 8605f44097a986e10c2ddaf4b4eae0b2331d98d1

    Description

      crashes on the second right click. Works with Qt 5.2.1.

      #include <QApplication>
      #include <QContextMenuEvent>
      #include <QMainWindow>
      #include <QMenu>
      
      class MainWindow : public QMainWindow
      {
      public:
        MainWindow(QWidget *parent = 0)
          : QMainWindow(parent)
        {
          submenu = new QMenu("Submenu", this);
        }
      
        virtual void contextMenuEvent(QContextMenuEvent *event)
        {
          submenu->clear();
          QAction *action = submenu->addAction("Test");
          action->setData(0); // Crash happens here second time...
      
          QMenu menu;
          menu.addMenu(submenu);
          menu.exec(event->globalPos());
        }
      
      private:
        QMenu *submenu;
      };
      
      int main (int argc, char *argv[])
      {
        QApplication app(argc, argv);
        MainWindow window;
        window.show();
        return app.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              dedietri Gabriel de Dietrich (drgvond)
              con Eike Ziller
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes