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

Calling hide() and show() on QDialog may result in X errors

    XMLWordPrintable

Details

    Description

      Calling hide() and show() in sequence on a QDialog may result in the following X errors:

      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 20 (X_GetProperty)
      Resource id: 0x16095c7
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 15 (X_QueryTree)
      Resource id: 0x16095c7
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 40 (X_TranslateCoords)
      Resource id: 0x16095c7

      This happens with 4.3 and 4.4

      The following example reproduces the problem:

      #include <QtGui>
      
      class Dialog : public QDialog {
          Q_OBJECT
      
      public:
          Dialog(QWidget *parent = 0) : QDialog(parent) {
              QPushButton *b = new QPushButton("hide/show", this);
              connect(b, SIGNAL(clicked()), this, SLOT(foo()));
          }
      
      public slots:
          void foo() {
              hide();
              show();
          }
      };
      
      #include "main.moc"
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
      
          Dialog dialog;
          dialog.show();
      
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes