Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QWidgetPrivate::setGeometry_sys crash on OSX after upgrade to 4.8.5 from 4.7.2
QtWS25 Last Chance

[SOLVED] QWidgetPrivate::setGeometry_sys crash on OSX after upgrade to 4.8.5 from 4.7.2

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sipickles
    wrote on last edited by
    #1

    Hi,

    I am porting an existing application from 4.7.2 to 4.8.5. On Linux, it builds and runs fine without modification, but on OSX (10.7.4) I get a crash in QWidgetPrivate::setGeometry_sys.

    The crash is in the last line of this block, line 4522:
    @
    // The window is moved and resized (or resized to zero).
    // Since Cocoa usually only sends us a resize callback after
    // setting a window frame, we issue an explicit move as
    // well. To stop Cocoa from optimize away the move (since the move
    // would have the same origin as the setFrame call) we shift the
    // window back and forth inbetween.
    cocoaFrameRect.origin.y += 1;
    [window setFrame:cocoaFrameRect display:realWindow];
    cocoaFrameRect.origin.y -= 1;
    [window setFrameOrigin:cocoaFrameRect.origin];
    @

    Although the native window looks valid in the debugger, I get an array out-of-bounds:

    @
    An uncaught exception was raised
    *** -[__NSArrayI objectAtIndex:]: index 0 beyond bounds for empty array
    (
    0 CoreFoundation 0x00007fff9469df56 __exceptionPreprocess + 198
    1 libobjc.A.dylib 0x00007fff8a7ecd5e objc_exception_throw + 43
    2 CoreFoundation 0x00007fff94647370 -[__NSArrayI objectAtIndex:] + 208
    3 libmyapp.dylib 0x00000001010471f7 -[CocoaWindowSnapper windowDidMoveNotification:] + 165
    4 Foundation 0x00007fff8a2a7d0e __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47
    5 CoreFoundation 0x00007fff946467ba _CFXNotificationPost + 2634
    6 Foundation 0x00007fff8a293fc3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
    7 AppKit 0x00007fff8d6d1f9b -[NSWindow _setFrameCommon:display:stashSize:] + 2130
    8 AppKit 0x00007fff8d771536 -[NSWindow setFrameOrigin:] + 338
    9 QtGui 0x00000001075d5e1c _ZN14QWidgetPrivate15setGeometry_sysEiiiib + 1792
    10 QtGui 0x00000001076d09bf _ZN7QWidget6resizeERK5QSize + 157
    .....

    )
    @

    Can anyone suggest a fix or workaround?

    Thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sipickles
      wrote on last edited by
      #2

      Found it.

      There was bad code in my app here:

      libmyapp.dylib 0x00000001010471f7 -[CocoaWindowSnapper windowDidMoveNotification:] + 165

      Thanks for looking

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        That code didn't crash with 4.7.2 ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sipickles
          wrote on last edited by
          #4

          Nope.

          The developer who wrote it had written a comment - "This may break in future versions of Qt"! I found out after debugging it.

          A compile time version check would have been more useful....

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Indeed... But a real fix would have been even better

            Glad you found out !

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved