Page 1 of 2

PB 5.0 b6 Crash at re-open fullscreen

Posted: Fri Oct 19, 2012 11:34 pm
by kenmo
Beta 6 is a great improvement, I can now run my game in fullscreen (at 60 FPS too)!

But I still have screen problems: now I get a crash (either IMA or "quit unexpectedly") when reopening a fullscreen (for example, to change to a new resolution).

OSX 10.7

Example:

Code: Select all

InitSprite()

; Open screen, draw red then green then blue
For color = 0 To 2
  If (OpenScreen(640, 480, 32, ""))
    ClearScreen($FF << (color*8))
    FlipBuffers()
    Delay(2000)
    CloseScreen()
    Delay(2000)
  EndIf
  Delay(2000)
Next color
EDIT: If it helps, I saw this error once or twice on CloseScreen():

Code: Select all

[ERROR] -{__NSMallocBlock__ __getValue:forKey:]: unrecognized selector sent to instance 0x2167fd0

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Mon Oct 22, 2012 4:01 pm
by Fred
Unfortunately, i can't reproduce it on my mac (10.6 and 10.8). Could you try this debug lib and give me the output ?

www.purebasic.com/beta/macosx_x86/Screen

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Tue Oct 23, 2012 3:22 am
by kenmo
With that library, I get the same result. The first OpenScreen / ClearScreen / CloseScreen seems to work OK, but then it hangs on the next OpenScreen, and quits unexpectedly after a few seconds.

Was it supposed to print a debug report somewhere? What output did you want?

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Tue Oct 23, 2012 3:59 am
by Fred
You have to launch the created exe from the terminal.

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Tue Oct 23, 2012 11:32 pm
by kenmo
OK, compiled the code posted above, first run:


Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
zsh: segmentation fault  ./test


Second run, from the same console, I didn't change anything:

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
Oct 23 17:48:47 comp.local test[341] <Warning>: displaySetMode: unable to find mode dict in array
close 10
close 11
close 12
Oct 23 17:48:47 comp.local test[341] <Warning>: displaySetMode: unable to find mode dict in array
close 13
close - OUT
zsh: trace trap  ./test


Third run:

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
zsh: trace trap  ./test


4th run:

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
2012-10-23 17:51:21.361 test[371:707] -[NSLock __getValue:forKey:]: unrecognized selector sent to instance 0x18cf50
2012-10-23 17:51:21.363 test[371:707] An uncaught exception was raised
2012-10-23 17:51:21.364 test[371:707] -[NSLock __getValue:forKey:]: unrecognized selector sent to instance 0x18cf50
2012-10-23 17:51:21.366 test[371:707] (
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   test                                0x000033c8 test + 9160
	9   test                                0x000028c6 test + 6342
	10  test                                0x000022b8 test + 4792
)
2012-10-23 17:51:21.367 test[371:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSLock __getValue:forKey:]: unrecognized selector sent to instance 0x18cf50'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   test                                0x000033c8 test + 9160
	9   test                                0x000028c6 test + 6342
	10  test                                0x000022b8 test + 4792
)
zsh: trace trap  ./test
5th run (I'm getting different output each time!)

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
Oct 23 17:52:56 comp.local test[388] <Warning>: displaySetMode: unable to find mode dict in array
close 10
close 11
close 12
Oct 23 17:52:56 comp.local test[388] <Warning>: displaySetMode: unable to find mode dict in array
close 13
close - OUT
zsh: trace trap  ./test
One more:

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
2012-10-23 17:53:53.944 test[404:707] -[__NSCFType __getValue:forKey:]: unrecognized selector sent to instance 0x67fa10
2012-10-23 17:53:54.004 test[404:707] An uncaught exception was raised
2012-10-23 17:53:54.005 test[404:707] -[__NSCFType __getValue:forKey:]: unrecognized selector sent to instance 0x67fa10
2012-10-23 17:53:54.006 test[404:707] (
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   test                                0x000033c8 test + 9160
	9   test                                0x000028c6 test + 6342
	10  test                                0x000022b8 test + 4792
)
2012-10-23 17:53:54.008 test[404:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType __getValue:forKey:]: unrecognized selector sent to instance 0x67fa10'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   test                                0x000033c8 test + 9160
	9   test                                0x000028c6 test + 6342
	10  test                                0x000022b8 test + 4792
)
zsh: trace trap  ./test

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 6:24 pm
by Fred
Thank you, we are getting closer. Could you download again the same file and give me the new output ?

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 10:31 pm
by kenmo
I still get a few different results:

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
zsh: segmentation fault  ./test
comp in ~/Desktop/test.app/Contents/MacOS 

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
Oct 24 17:24:44 comp.local test[563] <Warning>: displaySetMode: unable to find mode dict in array
close 10
close 11
close 12
zsh: bus error  ./test
comp in ~/Desktop/test.app/Contents/MacOS 

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
zsh: bus error  ./test
comp in ~/Desktop/test.app/Contents/MacOS 

Code: Select all

→ ./test
close 1
close 2
close 3
close 4
close 5
close 6
Oct 24 17:28:03 comp.local test[653] <Warning>: displaySetMode: unable to find mode dict in array
close 10
close 11
close 12
Oct 24 17:28:03 comp.local test[653] <Warning>: displaySetMode: unable to find mode dict in array
close 13
close - OUT
zsh: trace trap  ./test
comp in ~/Desktop/test.app/Contents/MacOS 

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 10:36 pm
by Fred
You should have another log in it, have you overwritten the lib and relaunched PB ?

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 10:57 pm
by kenmo
Yes, and I just re-downloaded and re-started to be sure. Same results as above...

I'm supposed to look at just the terminal output, right? Not any saved log file or anything else?

Are you sure the lib at that URL above is the updated one? (81,245 bytes)

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 10:58 pm
by Fred
I will re-up it for to be sure.

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Oct 24, 2012 11:06 pm
by Fred
Could you retry please ?

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Thu Oct 25, 2012 4:33 am
by kenmo
Tried it again with the debug lib (now 57 kB), here are 4 tries:

Code: Select all

→ ./test
current mode is: 4414288
fullscreen close
before siwtch(): 4414288
zsh: segmentation fault  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
current mode is: 1124688
fullscreen close
before siwtch(): 1124688
Oct 24 23:22:44 comp.local test[536] <Warning>: displaySetMode: unable to find mode dict in array
Oct 24 23:22:44 comp.local test[536] <Warning>: displaySetMode: unable to find mode dict in array
current mode is: 0
zsh: trace trap  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
current mode is: 1242816
fullscreen close
before siwtch(): 1242816
Oct 24 23:23:03 comp.local test[549] <Warning>: displaySetMode: unable to find mode dict in array
zsh: segmentation fault  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
current mode is: 4368384
fullscreen close
before siwtch(): 4368384
Oct 24 23:23:19 comp.local test[562] <Warning>: displaySetMode: unable to find mode dict in array
Oct 24 23:23:19 comp.local test[562] <Warning>: displaySetMode: unable to find mode dict in array
current mode is: 0
zsh: trace trap  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
Also tried it with the Beta 7 Screen lib, I noticed that same warning appears (not sure what it means):

Code: Select all

→ ./test
Oct 24 23:19:54 comp.local test[461] <Warning>: displaySetMode: unable to find mode dict in array
Oct 24 23:19:54 comp.local test[461] <Warning>: displaySetMode: unable to find mode dict in array
zsh: trace trap  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
zsh: bus error  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
Thanks for your time looking at this!

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Sat Nov 03, 2012 2:06 am
by kenmo
I don't know if this helps, but here are some more tests of the code example (all crashed)

PB 4.61 x86, OSX 10.7

Code: Select all

? ./Test
2012-11-02 16:36:03.640 Test[429:707] -[CFXPreferencesPropertyListSource __getValue:forKey:]: unrecognized selector sent to instance 0x635150
2012-11-02 16:36:03.643 Test[429:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CFXPreferencesPropertyListSource __getValue:forKey:]: unrecognized selector sent to instance 0x635150'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   Test                                0x00003394 Test + 9108
	9   Test                                0x00002854 Test + 6228
	10  Test                                0x00002248 Test + 4680
)
zsh: trace trap  ./Test
comp in ~/Desktop/test.app/Contents/MacOS 
comp in ~/Desktop/test.app/Contents/MacOS 
? ./Test
2012-11-02 16:36:39.548 Test[457:707] -[__NSCFArray __getValue:forKey:]: unrecognized selector sent to instance 0x41f5b0
2012-11-02 16:36:39.551 Test[457:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray __getValue:forKey:]: unrecognized selector sent to instance 0x41f5b0'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x9548ea67 __raiseError + 231
	1   libobjc.A.dylib                     0x98ab7149 objc_exception_throw + 155
	2   CoreFoundation                      0x95492070 -[NSObject doesNotRecognizeSelector:] + 256
	3   CoreFoundation                      0x953e0cd9 ___forwarding___ + 457
	4   CoreFoundation                      0x953e0aa2 _CF_forwarding_prep_0 + 50
	5   CoreFoundation                      0x9538a959 CFDictionaryGetValueIfPresent + 121
	6   CoreGraphics                        0x980fda15 CGDisplayModeMatchesModeDict + 120
	7   CoreGraphics                        0x980fe00f displaySetMode + 245
	8   Test                                0x00003394 Test + 9108
	9   Test                                0x00002854 Test + 6228
	10  Test                                0x00002248 Test + 4680
)
zsh: trace trap  ./Test
PB 5.00 beta 8 x86

Code: Select all

→ ./test    
zsh: segmentation fault  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
Nov  2 20:46:44 comp.local test[694] <Warning>: displaySetMode: unable to find mode dict in array
Nov  2 20:46:44 comp.local test[694] <Warning>: displaySetMode: unable to find mode dict in array
zsh: trace trap  ./test
PB 5.00 beta 8 x64

Code: Select all

→ ./test
zsh: segmentation fault  ./test
comp in ~/Desktop/test.app/Contents/MacOS 
→ ./test
zsh: segmentation fault  ./test

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Wed Nov 14, 2012 3:42 pm
by kenmo
Here's an update on this issue:

The good news:
- I've tested this on a few more Macs now, and none of them crash (only the Mac I'm developing on, of course :) )
- I'm going to release my game soon -- if other people have crashes then I will try to release a v1.1 fix later
- closing and re-opening a fullscreen is not something that happens very often anyway
- this might be important, or maybe it is totally unrelated: the crash seems to only happen when using an HDMI cable + television as my display (I don't know if this affects PureBasic at all... but other games run full-screen fine)

The bad news:
- it still happens in PB 5.0 Final :cry:
- sometimes it crashes on the second OpenScreen() and sometimes it crashes on the first CloseScreen() (maybe CloseScreen corrupts something which later causes OpenScreen to crash?)

Re: [PB 5.0 b6] Crash at re-open fullscreen

Posted: Tue Jan 15, 2013 5:26 pm
by Fred
Did you had users return about that ?