VirtualBox

Ignore:
Timestamp:
Jul 30, 2015 8:08:01 PM (9 years ago)
Author:
vboxsync
Message:

VMSVGA3d/darwin: Attempt to fix shutdown deadlock where the FIFO thread get stuck waiting in/on NSViewHirerarchyLock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m

    r57135 r57137  
    465465    if (m_pParentView)
    466466    {
    467         [self removeFromSuperview];
    468         [self setHidden:YES];
    469         [[NSNotificationCenter defaultCenter] removeObserver:self];
     467        /*
     468         * The removeFromSuperview has been frequently seen to deadlock thing like this:
     469         *   #0  0x00007fff8db440fa in __psynch_cvwait ()
     470         *   #1  0x00007fff8d0acfb9 in _pthread_cond_wait ()
     471         *   #2  0x00007fff8a1bc8f0 in -[NSViewHierarchyLock _lockForWriting:handler:] ()
     472         *   #3  0x00007fff8a1bc171 in -[NSView removeFromSuperview] ()
     473         *   #4  0x000000010cffb2bb in -[VMSVGA3DOverlayView vboxRemoveFromSuperviewAndHide] (self=0x10a1da550, _cmd=0x10cffd734) at DevVGA-SVGA3d-cocoa.m:467
     474         *   #5  0x000000010cffbed3 in vmsvga3dCocoaDestroyViewAndContext (pView=0x10a1da550, pCtx=0x10a1da630) at DevVGA-SVGA3d-cocoa.m:662
     475         * (This is from OS X 10.8.5.)
     476         */
     477        if ([NSThread isMainThread])
     478        {
     479            LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: calling removeFromSuperview\n", (void *)self));
     480            [self removeFromSuperview];
     481            LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: calling setHidden\n", (void *)self));
     482            [self setHidden:YES];
     483#if 0 /* doesn't work, or isn't really needed (scroll bar mess). */
     484            LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: calling setHidden\n", (void *)self));
     485            [[NSNotificationCenter defaultCenter] removeObserver:self];
     486#endif
     487        }
     488        else
     489        {
     490            LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: defering to main thread\n", (void *)self));
     491            vmsvga3dCocoaServiceRunLoop();
     492            [self performSelectorOnMainThread:@selector(vboxRemoveFromSuperviewAndHide) withObject:nil waitUntilDone:YES];
     493            vmsvga3dCocoaServiceRunLoop();
     494            LogFlow(("OvlView(%p) vboxRemoveFromSuperviewAndHide: main thread done\n", (void *)self));
     495        }
    470496    }
    471497}
     
    660686
    661687    /* The view */
    662     [(VMSVGA3DOverlayView *)pView vboxRemoveFromSuperviewAndHide];
    663 
    664     Log(("vmsvga3dCocoaDestroyViewAndContext: view %p ref count=%d\n", (void *)pView, [pView retainCount]));
    665     [pView release];
     688    VMSVGA3DOverlayView *pOvlView = (VMSVGA3DOverlayView *)pView;
     689    [pOvlView vboxRemoveFromSuperviewAndHide];
     690
     691    Log(("vmsvga3dCocoaDestroyViewAndContext: view %p ref count=%d\n", (void *)pOvlView, [pOvlView retainCount]));
     692    [pOvlView release];
    666693
    667694    /* The OpenGL context. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette