Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Pressing F12 crashes latest debug version of game.

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Pressing F12 crashes latest debug version of game.

Post by Switeck »

I still get this error with latest svn compile build (4652).
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Pressing F12 crashes latest debug version of game.

Post by Kaks »

That's right.

And it's not likely to be fixed either, it's an obscure gdb specific crash - it only ever happens if you run Oolite using gdb, and it's seemingly related to gdb's interaction with a native windows dll - its priority is therefore very low, and seemingly not coming from Oolite's code.

And given that the stack trace seems close to useless, the only way we'd have to fix it is to have a sudden, major brainwave.



This 'might' sound flippant, so here's more info! :)


Every single piece of code that gets called when pressing F12 is also called in other places without triggering this bug.

Here's what Oolite does when F12 is pressed:

Code: Select all

					case SDLK_F12:
						[self toggleScreenMode];
						if([[PlayerEntity sharedPlayer] guiScreen]==GUI_SCREEN_GAMEOPTIONS)
						{
							//refresh play windowed / full screen
							[[PlayerEntity sharedPlayer] setGuiToGameOptionsScreen];
						}
						break;
Oolite doesn't do anything else - at all - whenever F12 is pressed.

SDLK_F12 is a flag that's passed to Oolite by the SDL dll, and over which Oolite hasn't got any control.

If you're not looking at the game options screen all that happens is

Code: Select all

 [self toggleScreenMode];
if you're looking at the game options screen, Oolite redraws it, to toggle the display line to read 'play in full screen' and 'play in window' according to which mode you're in.

What happens when you toggle between full screen and windowed modes by clicking on the F2 'play in full screen' / 'play in window' line?

The relevant bit of code is this:

Code: Select all

	if ((guiSelectedRow == GUI_ROW(GAME,DISPLAYSTYLE)) && selectKeyPress)
	{
		[gameView toggleScreenMode];
		// redraw GUI
		[self setGuiToGameOptionsScreen];
	}
The only difference? It doesn't check to see if we're looking at the game option screen.
In order to reach this part of the code we must be looking at that screen, so no extra check is needed.

Naturally, the code to check if we're looking at a specific gui screen is used in a lot of different places, without causing any trouble at all.

So it's definitely a puzzle. And one with only 2-3 pieces at that!

I don't know if all SDL programs do crash the same way if ran via gdb & using the same windows dll, but my first guess would be an emphatic 'yup'!
It might be something that the SDL people are aware of already, and it might have been addressed for the upcoming version of that library, but I haven't checked that myself: 'meh, life's too short'. :D

In any case, there's always the gdb workaround I gave you before. You might want to change gdb's settings so it launches with

Code: Select all

handle SIGTRAP noprint nostop
by default...


Cheers,

Kaks.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Pressing F12 crashes latest debug version of game.

Post by CommonSenseOTB »

This is probably a stupid thought but what would happen if you substituted "===" in place of the "==" in the above sections of code?
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Pressing F12 crashes latest debug version of game.

Post by Capt. Murphy »

It's Obj C code not JS and == in Obj C is equivalent comparator to === in JS. Obj C doesn't have an equivalent 'fuzzy equals' that == is in JS.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
User avatar
Micha
Commodore
Commodore
Posts: 815
Joined: Tue Sep 02, 2008 2:01 pm
Location: London, UK
Contact:

Re: Pressing F12 crashes latest debug version of game.

Post by Micha »

CommonSenseOTB wrote:
This is probably a stupid thought but what would happen if you substituted "===" in place of the "==" in the above sections of code?
It wouldn't compile because "===" is not a valid Objective-C operation.

We're talking about the actual game code here, not about OXP Javascript.

Ninja'd! :lol:
The glass is twice as big as it needs to be.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Pressing F12 crashes latest debug version of game.

Post by Switeck »

Kaks wrote:
And it's not likely to be fixed either, it's an obscure gdb specific crash - it only ever happens if you run Oolite using gdb, and it's seemingly related to gdb's interaction with a native windows dll - its priority is therefore very low, and seemingly not coming from Oolite's code.

And given that the stack trace seems close to useless, the only way we'd have to fix it is to have a sudden, major brainwave.
...
In any case, there's always the gdb workaround I gave you before. You might want to change gdb's settings so it launches with

Code: Select all

handle SIGTRAP noprint nostop
by default...
I didn't put much value in backtrace results in the first place...but it seems I can't even trust the debugging tools. (To say nothing of Microsoft Windows XP itself!) I guess that means I'll have to get more creative in testing. :P
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Pressing F12 crashes latest debug version of game.

Post by CommonSenseOTB »

Capt. Murphy wrote:
It's Obj C code not JS and == in Obj C is equivalent comparator to === in JS. Obj C doesn't have an equivalent 'fuzzy equals' that == is in JS.
Micha wrote:
CommonSenseOTB wrote:
This is probably a stupid thought but what would happen if you substituted "===" in place of the "==" in the above sections of code?
It wouldn't compile because "===" is not a valid Objective-C operation.

We're talking about the actual game code here, not about OXP Javascript.

Ninja'd! :lol:
Thankyou Capt. Murphy and Micha. :D
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
Post Reply