After the recent change for touch events, I am getting accvios when debugging code on my computer that handles the orxSYSTEM_EVENT_TOUCH events. It's a bit intermittent but, for example, it happens when setting breakpoints in the event handling eID == orxSYSTEM_EVENT_TOUCH_END. When I examine the code and then continue the program, I get the access violation.
http://i.imgur.com/WGROK.png
Comments
- Happens with SVN 2938, too
- Only happens when an event handler is registered for orxEVENT_TYPE_SYSTEM
- Also happens when game is running and I press Alt+Tab to switch to my Visual Studio program
If you modify orxBounce.c, adds the already existing handler to the system event + a log made if ID == TOUCH_END + breakpoint, do you get the same result?
That's what I tried locally and it runs just fine. What's your configuration?
I don't think it's related to the touch events given your callstack, but probably more to the update to a newer version of GLFW that happened a week or two ago (except you didn't have any reason to put a breakpoint on these events).
Alt+tabbing shouldn't trigger the event send I see in your callstack but iconification should do it (orxSYSTEM_EVENT_BACKGROUND).
I'm running win7 64b + visual studio 2008 express + single screen. What's your configuration?
Problem remains
- I can reproduce this every single time I start the windowed program and then Alt+Tab to my VS window.
- I was suspicious of my configuration, too. My project doesn't build Orx (just links with it), but I deleted and fetched SVN again to make sure everything is correct.
- I was able to isolate the cause to the following line in my event handler. If I comment this, the exception doesn't happen:
The whole function is here: http://pastebin.com/n4vMPedN I commented out all the messy test code to isolate the problem line. Is there something wrong with my event handler?
- Problem does NOT happen with SVN rev. 2905. But of course not, since I have to comment the offending line to build it in that version!
- Problem DOES happen with SVN rev. 2941.
It seems to have it before that if/else block is illegal. I was under the impression I could put it there and save a few lines at the cost of an unused variable.
You access the payload->stTouch for any system event but it only contains data for touch events.
The part where it clashes is that there's not always a payload in an event! For focus or background/foreground events, there's no payload so you're dereferencing an invalid pointer!