[Lazarus] Catch ObjC Exception in TTrayIcon?

Tobias Giesen tobias_subscriber at tgtools.com
Tue Mar 8 12:30:37 CET 2011


Hello,

on one of my customer's machines, the line
  TrayIcon1.Visible:=true;

terminates the program, apparently with an ObjC exception inside MacOS.
I wonder if this exception can be caught and handled, or what could be
the cause? It works fine on all my machines.

Cheers,
Tobias

--------------------------------------

Process:         BackgroundScheduler [872]
Path:            /Users/TicoTeco/Desktop/SuperFlexibleSynchronizer.app/Contents/Resources/BackgroundScheduler.app/Contents/MacOS/BackgroundScheduler
Identifier:      com.company.BackgroundScheduler
Version:         0.1 (1)
Code Type:       X86 (Native)
Parent Process:  launchd [808]

Date/Time:       2011-03-08 11:40:30.471 +0100
OS Version:      Mac OS X 10.6.6 (10J567)
Report Version:  6

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
*** Terminating app due to uncaught exception 'NSImageCacheException', reason: 'Cannot lock focus on image <NSImage 0x2431190 Size={0, 0} Reps=(
)>, because it is size zero.'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x999616ba __raiseError + 410
	1   libobjc.A.dylib                     0x97093509 objc_exception_throw + 56
	2   CoreFoundation                      0x999613e8 +[NSException raise:format:arguments:] + 136
	3   CoreFoundation                      0x9996135a +[NSException raise:format:] + 58
	4   AppKit                              0x95a497d2 -[NSImage _lockFocusOnRepresentation:rect:context:hints:flipped:] + 267
	5   AppKit                              0x95a496bb __-[NSImage lockFocusWithRect:context:hints:flipped:]_block_invoke_1 + 114
	6   AppKit                              0x95939a44 -[NSImage _usingBestRepresentationForRect:context:hints:body:] + 189
	7   AppKit                              0x95a49641 -[NSImage lockFocusWithRect:context:hints:flipped:] + 204
	8   AppKit                              0x95aa082c -[NSImage lockFocusFlipped:] + 138
	9   AppKit                              0x95aa0799 -[NSImage lockFocus] + 64
	10  AppKit                              0x95af6cc0 -[NSWindow _generateScaledBackground] + 318
	11  AppKit                              0x95af6a07 -[NSWindow(NSWindow_CarbonEventHandlers) _setWindowDepth] + 126
	12  AppKit                              0x95f89d55 -[NSWindow(NSWindow_CarbonEventHandlers) _installCarbonWindowEventHandlers] + 121
	13  AppKit                              0x95af6538 -[NSWindow(NSCarbonExtensions) windowRef] + 561
	14  AppKit                              0x95e543e8 -[NSStatusBarWindow windowRef] + 80
	15  AppKit                              0x958f87f6 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1112
	16  AppKit                              0x95f4ae0d -[NSWindow orderFrontRegardless] + 82
	17  AppKit                              0x95e540a9 -[NSStatusBar(NSStatusBarCGS) _CGSinsertWindow:withPriority:] + 355
	18  AppKit                              0x95e51cd3 -[NSStatusBar _insertStatusItem:withPriority:] + 80
	19  AppKit                              0x95e553de -[NSStatusItem _initInStatusBar:withLength:withPriority:hidden:] + 462
	20  AppKit                              0x95e54638 -[NSStatusItem _initInStatusBar:withLength:withPriority:] + 63
	21  AppKit                              0x95e546a7 +[NSStatusItem _itemInStatusBar:withLength:withPriority:] + 105
	22  AppKit                              0x95e51e09 -[NSStatusBar _statusItemWithLength:withPriority:] + 58
	23  AppKit                              0x95e51e89 -[NSStatusBar statusItemWithLength:] + 49
	24  BackgroundScheduler                 0x00362d7a APPKIT_NSSTATUSBAR_$__STATUSITEMWITHLENGTH$SINGLE$$POBJC_OBJECT + 74
	25  BackgroundScheduler                 0x003e1be4 CARBONWSEXTCTRLS_TCARBONWSCUSTOMTRAYICON_$__SHOW$TCUSTOMTRAYICON$$BOOLEAN + 164
	26  BackgroundScheduler                 0x0038784e EXTCTRLS_TCUSTOMTRAYICON_$__SHOW$$BOOLEAN + 62
	27  BackgroundScheduler                 0x0038789c EXTCTRLS_TCUSTOMTRAYICON_$__SETVISIBLE$BOOLEAN + 28
	28  BackgroundScheduler                 0x000ac836 SYNCMAIN_TFSYNCMAIN_$__FORMSHOW$TOBJECT + 406
	29  BackgroundScheduler                 0x00010dce PASCALMAIN + 334
	30  BackgroundScheduler                 0x0002e0b5 FPC_SYSTEMMAIN + 69
	31  BackgroundScheduler                 0x00010b92 _start + 216
	32  BackgroundScheduler                 0x00010ab9 start + 41
)
 

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x999aca37 ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ + 7
1   libobjc.A.dylib               	0x97093509 objc_exception_throw + 56
2   com.apple.CoreFoundation      	0x999613e8 +[NSException raise:format:arguments:] + 136
3   com.apple.CoreFoundation      	0x9996135a +[NSException raise:format:] + 58
4   com.apple.AppKit              	0x95a497d2 -[NSImage _lockFocusOnRepresentation:rect:context:hints:flipped:] + 267
5   com.apple.AppKit              	0x95a496bb __-[NSImage lockFocusWithRect:context:hints:flipped:]_block_invoke_1 + 114
6   com.apple.AppKit              	0x95939a44 -[NSImage _usingBestRepresentationForRect:context:hints:body:] + 189
7   com.apple.AppKit              	0x95a49641 -[NSImage lockFocusWithRect:context:hints:flipped:] + 204
8   com.apple.AppKit              	0x95aa082c -[NSImage lockFocusFlipped:] + 138
9   com.apple.AppKit              	0x95aa0799 -[NSImage lockFocus] + 64
10  com.apple.AppKit              	0x95af6cc0 -[NSWindow _generateScaledBackground] + 318
11  com.apple.AppKit              	0x95af6a07 -[NSWindow(NSWindow_CarbonEventHandlers) _setWindowDepth] + 126
12  com.apple.AppKit              	0x95f89d55 -[NSWindow(NSWindow_CarbonEventHandlers) _installCarbonWindowEventHandlers] + 121
13  com.apple.AppKit              	0x95af6538 -[NSWindow(NSCarbonExtensions) windowRef] + 561
14  com.apple.AppKit              	0x95e543e8 -[NSStatusBarWindow windowRef] + 80
15  com.apple.AppKit              	0x958f87f6 -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1112
16  com.apple.AppKit              	0x95f4ae0d -[NSWindow orderFrontRegardless] + 82
17  com.apple.AppKit              	0x95e540a9 -[NSStatusBar(NSStatusBarCGS) _CGSinsertWindow:withPriority:] + 355
18  com.apple.AppKit              	0x95e51cd3 -[NSStatusBar _insertStatusItem:withPriority:] + 80
19  com.apple.AppKit              	0x95e553de -[NSStatusItem _initInStatusBar:withLength:withPriority:hidden:] + 462
20  com.apple.AppKit              	0x95e54638 -[NSStatusItem _initInStatusBar:withLength:withPriority:] + 63
21  com.apple.AppKit              	0x95e546a7 +[NSStatusItem _itemInStatusBar:withLength:withPriority:] + 105
22  com.apple.AppKit              	0x95e51e09 -[NSStatusBar _statusItemWithLength:withPriority:] + 58
23  com.apple.AppKit              	0x95e51e89 -[NSStatusBar statusItemWithLength:] + 49
24  ...company.BackgroundScheduler	0x00362d7a APPKIT_NSSTATUSBAR_$__STATUSITEMWITHLENGTH$SINGLE$$POBJC_OBJECT + 74 (NSStatusBar.inc:79)
25  ...company.BackgroundScheduler	0x003e1be4 CARBONWSEXTCTRLS_TCARBONWSCUSTOMTRAYICON_$__SHOW$TCUSTOMTRAYICON$$BOOLEAN + 164 (carbontrayicon.inc:489)
26  ...company.BackgroundScheduler	0x0038784e EXTCTRLS_TCUSTOMTRAYICON_$__SHOW$$BOOLEAN + 62 (customtrayicon.inc:130)
27  ...company.BackgroundScheduler	0x0038789c EXTCTRLS_TCUSTOMTRAYICON_$__SETVISIBLE$BOOLEAN + 28 (customtrayicon.inc:146)
28  ...company.BackgroundScheduler	0x000ac836 SYNCMAIN_TFSYNCMAIN_$__FORMSHOW$TOBJECT + 406
29  ...company.BackgroundScheduler	0x00010dce PASCALMAIN + 334
30  ...company.BackgroundScheduler	0x0002e0b5 SYSTEM_FPC_SYSTEMMAIN$LONGINT$PPCHAR$PPCHAR + 69
31  ...company.BackgroundScheduler	0x00010b92 _start + 216 (wincontrol.inc:5321)
32  ...company.BackgroundScheduler	0x00010ab9 start + 41

Thread 1:  Dispatch queue: com.apple.libdispatch-manager
0   libSystem.B.dylib             	0x94b24982 kevent + 10
1   libSystem.B.dylib             	0x94b2509c _dispatch_mgr_invoke + 215
2   libSystem.B.dylib             	0x94b24559 _dispatch_queue_invoke + 163
3   libSystem.B.dylib             	0x94b242fe _dispatch_worker_thread2 + 240
4   libSystem.B.dylib             	0x94b23d81 _pthread_wqthread + 390
5   libSystem.B.dylib             	0x94b23bc6 start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x970934e5  ecx: 0xa067e540  edx: 0x0000003b
  edi: 0xa0938af0  esi: 0x02435700  ebp: 0xbfffeec8  esp: 0xbfffeeb0
   ss: 0x0000001f  efl: 0x00000282  eip: 0x999aca37   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x0283f1fe






More information about the Lazarus mailing list