crash on a window close

  1. 8 months ago

    I have a window that pops up from my main window when a button is pressed and in the window a timer runs (set to 250) to refresh a canvas (puts new text over a colored png file). I'm thinking the timer is still trying to run on close and trying to access an object or variable that has already been killed off by the close button. Does that sound right? should I check every control and property for nil in the timer's action? Or might something else be causing this. Here is a partial crash report:

    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_CRASH (SIGABRT)
    Exception Codes:       0x0000000000000000, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Application Specific Information:
    abort() called
    *** error for object 0x7fe5d475eea8: incorrect checksum for freed object - object was probably modified after being freed.
     
    
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   libsystem_kernel.dylib        	0x00007fff7a26ab66 __pthread_kill + 10
    1   libsystem_pthread.dylib       	0x00007fff7a435080 pthread_kill + 333
    2   libsystem_c.dylib             	0x00007fff7a1c61ae abort + 127
    3   libsystem_malloc.dylib        	0x00007fff7a2cfad4 szone_error + 596
    4   libsystem_malloc.dylib        	0x00007fff7a2c4616 tiny_malloc_from_free_list + 1155
    5   libsystem_malloc.dylib        	0x00007fff7a2c33bf szone_malloc_should_clear + 422
    6   libsystem_malloc.dylib        	0x00007fff7a2c31bd malloc_zone_malloc + 103
    7   libsystem_malloc.dylib        	0x00007fff7a2c24c7 malloc + 24
    8   com.apple.CoreGraphics        	0x00007fff52709a24 std::__1::list<CG::Chunk, CG::Allocator<CG::Chunk> >::list(std::__1::list<CG::Chunk, CG::Allocator<CG::Chunk> > const&) + 70
    9   com.apple.CoreGraphics        	0x00007fff52709b11 std::__1::vector<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::__swap_out_circular_buffer(std::__1::__split_buffer<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath>&>&) + 49
    10  com.apple.CoreGraphics        	0x00007fff5275e370 void std::__1::vector<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::__push_back_slow_path<CG::Path::Subpath const&>(CG::Path::Subpath const&&&) + 222
    11  com.apple.CoreGraphics        	0x00007fff5275e241 CG::Path::Sequence::append(CG::Path::Shape*, CGAffineTransform const*) + 161
    12  com.apple.CoreGraphics        	0x00007fff5275e001 CGPathAddRects + 200
    13  com.apple.CoreGraphics        	0x00007fff5275c23c CGContextClipToRects + 141

    Another crash report gave me this:

    Crashed Thread:        0  Dispatch queue: com.apple.main-thread
    
    Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes:       EXC_I386_GPFLT
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Termination Signal:    Segmentation fault: 11
    Termination Reason:    Namespace SIGNAL, Code 0xb
    Terminating Process:   exc handler [0]
    
    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
    0   com.apple.CoreGraphics        	0x00007fff52709bbd std::__1::__list_imp<CG::Chunk, CG::Allocator<CG::Chunk> >::clear() + 31
    1   com.apple.CoreGraphics        	0x00007fff5272a072 std::__1::__vector_base<CG::Path::Subpath, CG::Allocator<CG::Path::Subpath> >::~__vector_base() + 40
    2   com.apple.CoreGraphics        	0x00007fff5272a03c CG::Path::Sequence::~Sequence() + 28
    3   com.apple.CoreGraphics        	0x00007fff5275e052 CGPathAddRects + 281
    4   com.apple.CoreGraphics        	0x00007fff5275c23c CGContextClipToRects + 141
    5   com.apple.AppKit              	0x00007fff4f9bb613 -[NSView _drawRect:clip:] + 1522
    6   com.apple.AppKit              	0x00007fff4f9ba598 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4844
    7   com.apple.AppKit              	0x00007fff4f9b9ec5 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 3097
    8   com.apple.AppKit              	0x00007fff4f9b8ddb -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 327
    9   com.apple.AppKit              	0x00007fff501244e0 -[NSView _oldDisplayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2051
    10  com.apple.AppKit              	0x00007fff4f9b7e5d -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 253
    11  com.apple.AppKit              	0x00007fff4f9b40b4 -[NSView displayIfNeeded] + 1581
    12  com.apple.AppKit              	0x00007fff4f9b3a52 -[NSWindow displayIfNeeded] + 321
    13  com.apple.AppKit              	0x00007fff5015460d ___NSWindowGetDisplayCycleObserver_block_invoke.5902 + 308
    14  com.apple.AppKit              	0x00007fff4f9b355e __37+[NSDisplayCycle currentDisplayCycle]_block_invoke + 695
    
  2. Roger C

    20 Sep 2018 Lewis Center, OH

    Why not set the

    timer1.mode = 0

    in the close event?

  3. Sam R

    20 Sep 2018 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    I see this occasionally also, but it's not consistent for me and therefore been impossible to reliably reproduce.

  4. yeah it's not consistent for me. I had disabled the timer on close but that didn't help. would mode = 0 act any differently?

    I put Try/Catch in the timer's action but haven't tested it long enough to see if it's preventing the crash. So far so good.

  5. had another crash with Try/Catch. It seems to either happen right after I close the window or maybe 15 seconds later when I go to click on another control. Would the Activity Monitor give me any clues other than the crash reports? just doesn't happen often enough to help me pinpoint it so i can figure out the cause.

  6. 2 weeks ago

    Thomas R

    May 10 Europe, France, Besancon

    I'm under El Capitan and I have this issue too. My Xojo apps crash sometimes when I close a document window (not Main window) or when I close the Main window and quit, and other windows are opened (then are closed when quit).

  7. Michel B

    May 11 Pre-Release Testers RubberViews.com

    Would you have a thread on that window ?

  8. Sam R

    May 11 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    Looking again at the second crash report; I can tell you its crashing while drawing the window chrome (buttons or title or stuff). My guess is that the OS thinks something needs updating; but the window is already out of scope.

  9. Norman P

    May 11 Pre-Release Testers, Xojo Pro Alberta Canada

    or a timer with a call later ?
    thats a frequent suspect

  10. Sam R

    May 11 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    @Norman P or a timer with a call later ?
    thats a frequent suspect

    That's true, bitten me a couple of times.

  11. 6 hours ago

    Thomas R

    6 hours ago Europe, France, Besancon
    Edited 5 hours ago

    It seems the random crash of closing window only appears when the window contains a ListBox. I thought, when I read in 2019r1.1 Release Notes "Listbox no longer leaks memory when Paint events are handled." that the bug will disappear but no.
    I open and close a window of one of my program which has no ListBox and I didn't reach to make it crash.
    I have 11 programs with window, I'm nearly sure only windows with ListBox crash when closed. But I can't be totally sure, I didn't feel a crash log.

    Does anybody else has the same feeling?

  12. 2 hours ago

    Michel B

    2 hours ago Pre-Release Testers RubberViews.com

    There was a bug a while ago where threads remained when closing windows, crashing badly.

    If you are close to be certain the listbox creates the crash at window close, you could remove it first.

  13. Norman P

    2 hours ago Pre-Release Testers, Xojo Pro Alberta Canada

    @Thomas R It seems the random crash of closing window only appears when the window contains a ListBox. I thought, when I read in 2019r1.1 Release Notes "Listbox no longer leaks memory when Paint events are handled." that the bug will disappear but no.
    I open and close a window of one of my program which has no ListBox and I didn't reach to make it crash.
    I have 11 programs with window, I'm nearly sure only windows with ListBox crash when closed. But I can't be totally sure, I didn't feel a crash log.

    Does anybody else has the same feeling?

    No
    Post a full crash log and there _might_ be something that can be determined
    Patricks are only partial and there could be relevant items that were truncated from those logs

  14. just now

    Thomas R

    58 minutes ago Europe, France, Besancon

    It's my synchronisation soft SyncTwoFolders. I launch the sync in a thread, before launch the thread, I put a flag DrapMenu to false and disable all buttons and menus. I can't close windows (cancel close not DrapMenu) neither than quit the app. The only button remaining active is the Start button which is became a stop button. Once the thread ends, it launch a timer which put the DrapMenu flag back to true and re-enable all buttons and menus, it open a log window showing all opérations of files synchonized. The bug occurs when I close this Log window (which is not the Main window), sometimes it crash on first attempt, sometimes I have to open and close it many times to reproduce the crash. I can open and close the Log window, it remember the files synchronized in the last synchronization. I'm running El Capitan.
    Here is the crash log :

    I have problem posting with the crash log in the post. Please download it SyncTwoFolders-CrashLog-01.txt .

  15. Thomas R

    44 minutes ago Europe, France, Besancon

    The second soft is MemoDate which as the ListBox on its MainWindow. Same as my others programs, before launch the thread, I put a flag to false and disable all buttons and menus except the start button which become Stop. I can't quit, can't close window. The thread read a text file and Apple AdressBook birthday and list oncoming event in the listbox. When the thread ends it launch a timer which put the flag back to true and re-enable menus and buttons.
    When I quit the application, or close the Main window which quit the app, I sometimes have the crash.
    Please download it MemoDate-CrashLog-01.txt .

or Sign Up to reply!