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

Crash with setUnifiedTitleAndToolBarOnMac and toggling fullscreen to normal view

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.7.2, 4.8.3
    • 4.7.1
    • Widgets: Main Window
    • None
    • Mac OS X 10.6.5, Qt 4.7.1
    • 5fd505cac71e97cf181c0d05867a77e640814fc6

      When setting setUnifiedTitleAndToolBarOnMac to true and going to fullscreen and back to normal view, the application crashes, see stack trace in attached text file.

      How to reproduce

      • On a Mac, Compile the attached example code
      • Go fullscreen (CMD + F or toggle action in toolbar/menu)
      • Go normal view (again same action)
      • crash

      Example code

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);    	
          setUnifiedTitleAndToolBarOnMac(true);
      }
      
      MainWindow::~MainWindow()
      {
          delete ui;
      }
      
      void MainWindow::on_fullscreenAction_triggered()
      {
          if (!isFullScreen()) {
              // setUnifiedTitleAndToolBarOnMac(false);
              showFullScreen();
          } else {
              // setUnifiedTitleAndToolBarOnMac(true);
              showNormal();
          }
      }
      

      Workaround

      When following the advice on http://doc.trolltech.com/4.7/qmainwindow.html#unifiedTitleAndToolBarOnMac-prop : "However, a good practice would be that turning off the unified toolbar before you call showFullScreen() and restoring it after you call showNormal()." then there is no crash. See commented out code.

      Example code attached.

        1. crash.txt
          6 kB
          Ivan Komissarov
        2. MacFullscreen.zip
          6 kB
          Oliver Knoll
        3. MacFullscreen 2.zip
          8 kB
          Ivan Komissarov
        4. StackTrace.txt
          4 kB
          Oliver Knoll
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            teemukat Teemu Katajisto (Inactive)
            till213 Oliver Knoll
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes