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

QApplication crash if screen count is zero

    XMLWordPrintable

Details

    • f2111ff1d7ce3b521f447baf1a6bb42bfad83d9d, 51d4eb8f5ba769cd50457b2f479acc3f30b9f78f

    Description

      QApplication assumes that screen is always available when creating it. But screen count can be also zero. It's possible when using application auto launching (Login Items). There should be some safety if screen count is zero for any reason. For example do rest of QApplication painting initialization after screen is added.

      Crash log shows that colormap initialize cause the crash

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      QtGui 0x0000000100296954 QScreen::depth() const + 4
      QtWidgets 0x000000010107a81d QColormap::initialize() + 61
      QtWidgets 0x0000000100da6749 0x100d2a000 + 509769
      QtWidgets 0x0000000100d5209d QApplicationPrivate::construct() + 61 
      

      To reproduce:

      • System: Maverics 10.9 OSX
      • Qt version: 5.2.0

      For the both case please find Steps to reproduce:
      1) Build the sample application using Qt 5.2.0 and you get a binary image example sample.app
      2) So copy this sample.app into /Application folder so that all users can run this application
      3) Make this application as a login item for two or three users. For this go to System Preferences -> select Login items tab -> add the application name sample.app. Do this for all other users as well.
      4) After adding the sample.app as login item for all users,then logout from all users.
      5) Restart the Mac. This is critical to reproduce crash to QApplication.
      6) Now start login to first user and then switch between different users.Then you will get crash.

      Related case QTBUG-37878.

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes