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

qt_mac_cgimage_to_nsimage throws unhandled NSException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.1.0 RC1
    • 5.0.0
    • Image formats
    • None
    • Mac OS X 10.8.2
    • macOS
    • 9f28f8bcbbf72d737616bcf57820c1e4bef3be95

    Description

      Due to bug in icon handling (QTBUG-7486), attempt to add icon with wrong file path throws an exception in qt_mac_cgimage_to_nsimage. This happens because most of qt_mac_* functions don't check their parameters. Problem starts in QCocoaMenuItem::sync:

          if (!m_icon.isNull()) {
              NSImage *img = static_cast<NSImage *>(qt_mac_create_nsimage(m_icon.pixmap(16, QIcon::Normal)));
      

      Icon is not null, but pixmap is null. qt_mac_create_nsimage doen't check if pixmap is null and create zero CGImage which is passed to qt_mac_cgimage_to_nsimage (it has no checks too). So either this funciotns need more checks (or, at least, assertions), or icon null handling should be fixed.

      0	__cxa_throw			0x7fff954b554d	
      1	objc_exception_throw			0x7fff8ede250c	
      2	+[NSException raise:format:]			0x7fff9563fe7c	
      3	-[NSImage _lockFocusOnRepresentation:rect:context:hints:flipped:]			0x7fff94ae02fc	
      4	__51-[NSImage lockFocusWithRect:context:hints:flipped:]_block_invoke_0			0x7fff94ae0198	
      5	-[NSImage _usingBestRepresentationForRect:context:hints:body:]			0x7fff94a2f4d6	
      6	-[NSImage lockFocusWithRect:context:hints:flipped:]			0x7fff94ae0136	
      7	-[NSImage lockFocusFlipped:]			0x7fff94ae0056	
      8	qt_mac_cgimage_to_nsimage	qcocoahelpers.mm	130	0x10b25b955	
      9	qt_mac_create_nsimage	qcocoahelpers.mm	143	0x10b25bad9	
      10	QCocoaMenuItem::sync	qcocoamenuitem.mm	309	0x10b254226	
      11	QCocoaMenu::insertMenuItem	qcocoamenu.mm	142	0x10b24fc01	
      12	QMenu::actionEvent	qmenu.cpp	2888	0x102a5bdb4	
      13	QWidget::event	qwidget.cpp	8182	0x1028b60c6	
      14	QMenu::event	qmenu.cpp	2383	0x102a590ce	
      15	QApplicationPrivate::notify_helper	qapplication.cpp	3357	0x10285d0d5	
      16	QApplication::notify	qapplication.cpp	3322	0x102861a03	
      17	Application::notify	application.cpp	79	0x10012f576	
      18	QCoreApplication::notifyInternal	qcoreapplication.cpp	767	0x1040eba3f	
      19	QCoreApplication::sendEvent	qcoreapplication.h	203	0x10284000a	
      20	QWidget::insertAction	qwidget.cpp	2956	0x1028a8291	
      21	QWidget::addAction	qwidget.cpp	2911	0x1028a812a	
      

      Attachments

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

        Activity

          People

            dedietri Gabriel de Dietrich (drgvond)
            arch Ivan Komissarov
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes