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

QGuiApplication::setWindowIcon crashes on macOS

    XMLWordPrintable

Details

    • macOS
    • cd41b01f32104a484db53e8a1ea913d596c939c7 (qt/qtbase/5.15.0)

    Description

      Using 5.15 beta3, QGuiApplication::setWindowIcon crashes on macOS when trying to set the application icon.

      *** Terminating app due to uncaught exception 'NSImageCacheException', reason: 'Cannot lock focus on image <NSImage 0x7fd53bca0240 Size={0, 0} Reps=(
      )>, because it is size zero.'
      *** First throw call stack:
      (
      	0   CoreFoundation                      0x00007fff39027d07 __exceptionPreprocess + 250
      	1   libobjc.A.dylib                     0x00007fff71d565bf objc_exception_throw + 48
      	2   CoreFoundation                      0x00007fff39027b65 +[NSException raise:format:] + 189
      	3   AppKit                              0x00007fff363a7d5d -[NSImage _lockFocusOnRepresentation:rect:context:hints:flipped:] + 316
      	4   AppKit                              0x00007fff363a7c0b __51-[NSImage lockFocusWithRect:context:hints:flipped:]_block_invoke + 66
      	5   AppKit                              0x00007fff36384135 -[NSImage _usingBestRepresentationForRect:context:hints:body:] + 145
      	6   AppKit                              0x00007fff363a7bbf -[NSImage lockFocusWithRect:context:hints:flipped:] + 141
      	7   AppKit                              0x00007fff364368c3 -[NSImage lockFocusFlipped:] + 111
      	8   AppKit                              0x00007fff36501fef __45-[NSApplication _updateIconImageFromOriginal]_block_invoke + 38
      	9   AppKit                              0x00007fff362153b1 +[NSAppearance _performWithCurrentAppearance:usingBlock:] + 66
      	10  AppKit                              0x00007fff36501f22 -[NSApplication _updateIconImageFromOriginal] + 328
      	11  AppKit                              0x00007fff36501d55 -[NSApplication _setApplicationIconImage:setDockImage:] + 68
      	12  QtGui                               0x0000000109d14393 _ZN15QGuiApplication13setWindowIconERK5QIcon + 103
      	13  AusweisApp2                         0x000000010817332e _ZN10governikus11UIPlugInQmlC2Ev + 590
      	14  AusweisApp2                         0x00000001081754a5 _ZN10governikus11UIPlugInQmlC1Ev + 21
      	15  AusweisApp2                         0x000000010812e8c1 _ZL30qt_plugin_instance_UIPlugInQmlv + 145
      	16  AusweisApp2                         0x00000001084d5213 _ZN10governikus8UILoader4loadENS_16EnumUIPlugInName12UIPlugInNameE + 963
      	17  AusweisApp2                         0x00000001084d4c74 _ZN10governikus8UILoader4loadEv + 180
      	18  AusweisApp2                         0x0000000108300369 _ZN10governikus13AppController5startEv + 345
      	19  AusweisApp2                         0x000000010811c0c9 _ZN10governikus7initAppERiPPc + 201
      	20  AusweisApp2                         0x000000010811baa1 main + 49
      	21  libdyld.dylib                       0x00007fff72efdcc9 start + 1
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException
      
      

      I assume this behaviour was introduced in https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.15&id=bee3d0fc1310da6685dce9cf9b1334fb8295aa9a and https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.15&id=059c3ae66adc1732f1d50ec5183a54b7bb97c347 . We create an Icon like this:

      auto icon = QIcon(QStringLiteral(":/images/macos/appIcon.svg"))
      QGuiApplication::setWindowIcon(icon);
      

      availableSizes() on the icon returns an empty list, which could at first glance be responsible for the issue.

      Attachments

        For Gerrit Dashboard: QTBUG-83494
        # Subject Branch Project Status CR V

        Activity

          People

            vestbo Tor Arne Vestbø
            jtrillma Jens Trillmann
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes