SDL 1.3 crash in SDL_cocoakeyboard.m

Hello there,

I’m having crashes (segfaults) in SDL_cocoakeyboard.m in latest SDL 1.3, I’ve checked the Bug tracker at www.libsdl.org but it doesn’t seem to be very alive. Should I post bugs there? Or I could do that here as well?

thanks,
Pavel

Example crash:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001002028ef in SDL_SendKeyboardKey (index=0, state=1 ‘\001’, scancode=SDL_SCANCODE_L) at src/events/SDL_keyboard.c:814
814 if (SDL_GetEventState(type) == SDL_ENABLE) {
(gdb) bt
#0 0x00000001002028ef in SDL_SendKeyboardKey (index=0, state=1 ‘\001’, scancode=SDL_SCANCODE_L) at src/events/SDL_keyboard.c:814
#1 0x0000000100257afe in Cocoa_HandleKeyEvent (_this=0x10082bd30, event=0x118cbb3b0) at src/video/cocoa/SDL_cocoakeyboard.m:708
#2 0x00000001002569ce in Cocoa_PumpEvents (_this=0x10082bd30) at src/video/cocoa/SDL_cocoaevents.m:213
#3 0x0000000100201785 in SDL_ShouldPollJoystick [inlined] () at /Users/pavel/Sources/SDL/src/events/SDL_events.c:428
#4 0x0000000100201785 in SDL_PumpEvents () at src/events/SDL_events.c:432
#5 0x0000000100201bb5 in SDL_WaitEventTimeout (event=0x7fff5fbff848, timeout=-1) at src/events/SDL_events.c:462

This happens always on MacOSX version of SDL 1.3, when I open About Application dialog and press any key, it will crash like this. It happens also when switching keyboard layout, I can send a backtrace when this happens again.

http://bugzilla.libsdl.org/show_bug.cgi?id=960
there’s a patch but it’s not completely fixing the bug (causes another
crash and doesn’t work on iphone)
you can either wait tor the devs to fix it or dive in the beauty of debuggin :wink:

vittorioOn Mon, Apr 19, 2010 at 10:07 PM, Pavel Kanzelsberger wrote:

Hello there,

I’m having crashes (segfaults) in SDL_cocoakeyboard.m in latest SDL 1.3, I’ve checked the Bug tracker at www.libsdl.org but it doesn’t seem to be very alive. Should I post bugs there? Or I could do that here as well?

thanks,
Pavel

Example crash:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
0x00000001002028ef in SDL_SendKeyboardKey (index=0, state=1 ‘\001’, scancode=SDL_SCANCODE_L) at src/events/SDL_keyboard.c:814
814 ? ? ? ? if (SDL_GetEventState(type) == SDL_ENABLE) {
(gdb) bt
#0 ?0x00000001002028ef in SDL_SendKeyboardKey (index=0, state=1 ‘\001’, scancode=SDL_SCANCODE_L) at src/events/SDL_keyboard.c:814
#1 ?0x0000000100257afe in Cocoa_HandleKeyEvent (_this=0x10082bd30, event=0x118cbb3b0) at src/video/cocoa/SDL_cocoakeyboard.m:708
#2 ?0x00000001002569ce in Cocoa_PumpEvents (_this=0x10082bd30) at src/video/cocoa/SDL_cocoaevents.m:213
#3 ?0x0000000100201785 in SDL_ShouldPollJoystick [inlined] () at /Users/pavel/Sources/SDL/src/events/SDL_events.c:428
#4 ?0x0000000100201785 in SDL_PumpEvents () at src/events/SDL_events.c:432
#5 ?0x0000000100201bb5 in SDL_WaitEventTimeout (event=0x7fff5fbff848, timeout=-1) at src/events/SDL_events.c:462

This happens always on MacOSX version of SDL 1.3, when I open About Application dialog and press any key, it will crash like this. It happens also when switching keyboard layout, I can send a backtrace when this happens again.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Pavel,On Tue, Apr 20, 2010 at 4:07 AM, Pavel Kanzelsberger wrote:

I’m having crashes (segfaults) in SDL_cocoakeyboard.m in latest SDL 1.3, I’ve checked the Bug tracker at www.libsdl.org but it doesn’t seem to be very alive. Should I post bugs there? Or I could do that here as well?

As Vittorio G. pointed out, it’s a known bug that we intended to fix.
However it’s still unclear what caused the 0x0 keyboard->focus, that’s
why I wish I can reproduce it. Is there any chance you can reduce it
to a minimized sample? Meanwhile, you can use the patch posted as a
temporary fix.

  • Jiang

Hello,

ok I will give it a try with this patch. I could send a small example
program that crashes, but it’s not written in C but in freepascal.

Basically it will always crash when a key press occurs in a window
that is not created by SDL (for example About Application dialog) and
sometimes when switching keyboard layouts…

PavelOn 20.4.2010, at 3:15, Jjgod Jiang wrote:

Hi Pavel,

On Tue, Apr 20, 2010 at 4:07 AM, Pavel Kanzelsberger <@Pavel_Kanzelsberger wrote:

I’m having crashes (segfaults) in SDL_cocoakeyboard.m in latest SDL
1.3, I’ve checked the Bug tracker at www.libsdl.org but it doesn’t
seem to be very alive. Should I post bugs there? Or I could do that
here as well?

As Vittorio G. pointed out, it’s a known bug that we intended to fix.
However it’s still unclear what caused the 0x0 keyboard->focus, that’s
why I wish I can reproduce it. Is there any chance you can reduce it
to a minimized sample? Meanwhile, you can use the patch posted as a
temporary fix.

  • Jiang

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pavel Kanzelsberger


E-Mail: pavel at kanzelsberger.com
Jabber: kanzelsberger at jabber.org, ICQ: 20990633

Hello Jiang,

I tried the proposed patch and it will fix crashes. When there’s
foreign window not created by SDL, it will properly push events that
report windowID==0 …

I will play with it a little bit more to see if there’s another
unusual behaviour caused by this, or any other related crashes.

PavelOn 20.4.2010, at 3:15, Jjgod Jiang wrote:

Hi Pavel,

On Tue, Apr 20, 2010 at 4:07 AM, Pavel Kanzelsberger <@Pavel_Kanzelsberger wrote:

I’m having crashes (segfaults) in SDL_cocoakeyboard.m in latest SDL
1.3, I’ve checked the Bug tracker at www.libsdl.org but it doesn’t
seem to be very alive. Should I post bugs there? Or I could do that
here as well?

As Vittorio G. pointed out, it’s a known bug that we intended to fix.
However it’s still unclear what caused the 0x0 keyboard->focus, that’s
why I wish I can reproduce it. Is there any chance you can reduce it
to a minimized sample? Meanwhile, you can use the patch posted as a
temporary fix.

  • Jiang

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pavel Kanzelsberger


E-Mail: pavel at kanzelsberger.com
Jabber: kanzelsberger at jabber.org, ICQ: 20990633

Hi,On Tue, Apr 20, 2010 at 3:16 PM, Pavel Kanzelsberger wrote:

I tried the proposed patch and it will fix crashes. When there’s foreign
window not created by SDL, it will properly push events that report
windowID==0 …

I see, I think that’s the best we can do here, since these windows are not
managed by SDL. It will be nice if Sam can take a look and integrate this
patch into the HG repo.

  • Jiang

It’s in, thanks!On Tue, Apr 20, 2010 at 2:00 AM, Jjgod Jiang wrote:

Hi,

On Tue, Apr 20, 2010 at 3:16 PM, Pavel Kanzelsberger wrote:

I tried the proposed patch and it will fix crashes. When there’s foreign
window not created by SDL, it will properly push events that report
windowID==0 …

I see, I think that’s the best we can do here, since these windows are not
managed by SDL. It will be nice if Sam can take a look and integrate this
patch into the HG repo.

  • Jiang


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Hi,

thanks, SDL hg also works for me now …

changeset: 4437:25e45611fa3d

/alfredOn 4/20/10 4:19 PM, Sam Lantinga wrote:

It’s in, thanks!

On Tue, Apr 20, 2010 at 2:00 AM, Jjgod Jiang wrote:

Hi,

On Tue, Apr 20, 2010 at 3:16 PM, Pavel Kanzelsberger wrote:

I tried the proposed patch and it will fix crashes. When there’s foreign
window not created by SDL, it will properly push events that report
windowID==0 …

I see, I think that’s the best we can do here, since these windows are not
managed by SDL. It will be nice if Sam can take a look and integrate this
patch into the HG repo.

  • Jiang