app crashed in lockfocusifcandr

First of all, I must explain that the hyphen in lockFocusIfCan-Draw is redundant. But without the hyphen, when I click the post button, there's always a warning as below :


The message contains invalid characters.



I'm really cofused about it.



Back to my question, we have met crashes in [NSView lockFocusIfCan-Draw] many times in our app.



The pseudo-code which runs in a CVDisplayLink callback is as follows:




if ([self window] && [[self window] isVisible] && ![self isHiddenOrHasHiddenAncestor] && [self lockFocusIfCan-Draw])
{

    // opengl rendering
    [self unlockFocus];

}




Any comment or advice is appreciated.


Replies

And call stack is as below.



Date/Time:

2017-11-15 14:23:37.741 +0800



OS Version:

Mac OS X 10.11.6 (15G1510)



Report Version:

11



Anonymous UUID:

DABD7C91-0018-244A-D765-D911F8A7C579




Sleep/Wake UUID:

CABA66E4-376C-4830-B5CD-739509733558




Time Awake Since Boot: 510000 seconds



Time Since Wake:



23000 seconds




System Integrity Protection: enabled




Crashed Thread:



41 CVDisplayLink




Exception Type:



EXC_BAD_ACCESS (SIGSEGV)



Exception Codes:



KERN_INVALID_ADDRESS at 0x0000000000000010




VM Regions Near 0x10:



-->



__TEXT



000000000009e000-000000000034c000 [ 2744K] r-x/rwx SM=COW /Users/USER/Library/Application Support/WebEx Folder//Meeting Center.app/Contents/MacOS/Meeting Center


Thread 41 Crashed:: CVDisplayLink



0 com.apple.AppKit



0x98a24a46 -[NSFocusStack focusView:inWindow:] + 148



1 com.apple.AppKit



0x98a22eb8 -[NSView lockFocusIfCan-Draw] + 618



2 com.apple.AppKit



0x98ca395c -[NSOpenGLView lockFocusIfCan-Draw] + 132



3 com.cisco.wseclient



0x012559a5 -[WseMacOpenGLRenderView RenderForTime:flagsOut:] + 364



4 com.cisco.wseclient



0x01255834 WseDisplayLinkRenderCallback(__CVDisplayLink*, CVTimeStamp const*, CVTimeStamp const*, unsigned long long, unsigned long long*, void*) + 32



5 com.apple.CoreVideo



0x92e6df54 CVDisplayLink::performIO(CVTimeStamp*) + 346



6 com.apple.CoreVideo



0x92e6d9d4 CVDisplayLink::runIOThread() + 874



7 com.apple.CoreVideo



0x92e6d2bb startIOThread(void*) + 159



8 libsystem_pthread.dylib



0x9aaa0780 _pthread_body + 138



9 libsystem_pthread.dylib



0x9aaa06f6 _pthread_start + 155



10 libsystem_pthread.dylib



0x9aa9df7a thread_start + 34

Here's another crash.


Date/Time:

2017-10-25 14:45:04.760 +0800

OS Version:

Mac OS X 10.12.5 (16F73)

Report Version:

12

Anonymous UUID:

CA800496-F01B-64D1-B985-B6BAB5F37E38


Sleep/Wake UUID:

94428F2A-7B6C-40F9-BA3C-0E382160AF0B


Time Awake Since Boot: 220000 seconds

Time Since Wake:

18000 seconds


System Integrity Protection: enabled


Crashed Thread:

20 CVDisplayLink


Exception Type:

EXC_BREAKPOINT (SIGTRAP)

Exception Codes:

0x0000000000000002, 0x0000000000000000

Exception Note:

EXC_CORPSE_NOTIFY


Termination Signal:

Trace/BPT trap: 5

Termination Reason:

Namespace SIGNAL, Code 0x5

Terminating Process: exc handler [0]


Application Specific Information:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '*** -[NSMapTable NSMapTable {

[10] <NSThread: 0x7bf6a2c0>{number = 1, name = (null)} -> <NSWindowGraphicsContext: 0x8500d920>

}

] count underflow'


Application Specific Backtrace 1:

0 CoreFoundation

0x9437627b __raiseError + 187

1 libobjc.A.dylib

0xa0cb86f2 objc_exception_throw + 273

2 CoreFoundation

0x94376195 +[NSException raise:format:] + 133

3 Foundation

0x95b72926 -[NSConcreteMapTable raiseCountUnderflowException] + 50

4 Foundation

0x95a08bd7 probeGC + 390

5 Foundation

0x95a08c60 -[NSConcreteMapTable setObject:forKey:] + 52

6 AppKit

0x920c2310 -[NSWindow _threadContext] + 398

7 AppKit

0x920c2064 -[NSView _contextForLockFocus:] + 126

8 AppKit

0x920c1a52 -[NSView lockFocusIfCan-Draw] + 235

9 AppKit

0x922eaa98 -[NSOpenGLView lockFocusIfCan-Draw] + 129

10 wseclient

0x012e1372 -[WseMacOpenGLRenderView RenderForTime:flagsOut:] + 373

11 wseclient

0x012e11f8 _ZL28WseDisplayLinkRenderCallbackP15__CVDisplayLinkPK11CVTimeStampS3_yPyPv + 32

12 CoreVideo

0x95877c17 _ZN13CVDisplayLink9performIOEP11CVTimeStamp + 283

13 CoreVideo

0x95877645 _ZN13CVDisplayLink11runIOThreadEv + 919

14 libsystem_pthread.dylib

0xa173d047 _pthread_body + 184

15 libsystem_pthread.dylib

0xa173cf8f _pthread_body + 0

16 libsystem_pthread.dylib

0xa173c84a thread_start + 34