Menu

#2300 Drag and drop crash on macOS

Bug
closed-fixed
nobody
5
2021-12-06
2021-11-30
No
Application Specific Information:
*** Terminating app due to uncaught exception 'NSImageCacheException', reason: 'Cannot lock focus on image <NSImage 0x600005b85040 Size={0, 0} RepProvider=(null)>, because it is size zero.'
terminating with uncaught exception of type NSException
abort() called

I've had a few reports of random crashes seemingly from drag and drop. The reports seem to have started coming after the release of Big Sur but there have been so few of them I can't be sure that's when it started. I can never pin down exactly what they're doing to cause the crash but the crash log indicates the crash happens in ScintillaCocoa::StartDrag(). I solved the crash by adding

if (selectionRectangle.size.width == 0. && selectionRectangle.size.height == 0.)
   return;

after

NSRect selectionRectangle = PRectangleToNSRect(rcSel);

I wasn't sure I needed to check whether both width and height are 0 and either width and height are 0 but I haven't had anymore reports after making the change to check that both are equal to 0.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-11-30

    Committed similar as [b7e12b]. Its safer to return if either height or width is 0 and that is the job of NSIsEmptyRect so that is used.

    https://developer.apple.com/documentation/foundation/1391228-nsisemptyrect?language=objc

    Can't see how to reproduce the problem myself since empty selections are weeded out at top of StartDrag so would like to know how this is caused.

     

    Related

    Commit: [b7e12b]

  • Neil Hodgson

    Neil Hodgson - 2021-12-01
    • labels: macOS --> macOS, scintilla
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2021-12-06
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.