Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: DInput crash during pollEvent  (Read 4135 times)

0 Members and 1 Guest are viewing this topic.

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
DInput crash during pollEvent
« on: October 22, 2013, 03:13:38 pm »
Hello everyone,

I'm experiencing a weird crash while running a very simple SFML application. Here is the code below:

#include "stdafx.h"

#include <SFML\Graphics.hpp>
#include <SFML\OpenGL.hpp>
#include <SFML\System.hpp>
#include <SFML\Window.hpp>

int main(int argc, char *argv[])
{
   sf::RenderWindow window;
   window.create( sf::VideoMode( 800, 600 ), "SFML", sf::Style::Default );
   window.setFramerateLimit( 60 );

   sf::Event event;
   while( window.isOpen() )
   {
      window.pollEvent( event );
   }

   return 0;
}

This crash occurs on both SFML 2.1 and the latest Unofficial Nightly Build (2013-09-24) running Windows 7 32bit. I've managed to get the crash while debugging, and here is the callstack:

dinput.dll!_CJoyCfg_New@12()   Unknown
dinput.dll!_StringCbCopyW@12() Unknown
dinput.dll!_hresDupPtszPptsz@8()       Unknown
dinput.dll!_CHid_Init@8()      Unknown
dinput.dll!_CHid_New@16()      Unknown
dinput.dll!_DIWdm_JoyHidMapping@16()   Unknown
dinput.dll!_JoyReg_GetConfigInternal@16()      Unknown
dinput.dll!_JoyReg_GetConfig@16()      Unknown
dinput.dll!_CJoyCfg_GetConfig@16()     Unknown
winmm.dll!_joyOpen@8() Unknown
winmm.dll!_joyGetPosEx@8()     Unknown
sfml-window-d-2.dll!0f9c941d()  Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for sfml-window-d-2.dll]      
sfml-window-d-2.dll!sf::Joystick::operator=() + 482 bytes       Unknown
sfml-window-d-2.dll!sf::Window::initialize() + 5176 bytes       Unknown
sfml-window-d-2.dll!sf::Window::initialize() + 4581 bytes       Unknown
sfml-window-d-2.dll!sf::Window::pollEvent() + 40 bytes  Unknown
ConsoleApplication2.exe!main(int argc, char * * argv) Line 44   C++
ConsoleApplication2.exe!__tmainCRTStartup() Line 536    C
ConsoleApplication2.exe!mainCRTStartup() Line 377       C
kernel32.dll!@BaseThreadInitThunk@12() Unknown
ntdll.dll!___RtlUserThreadStart@8()    Unknown
ntdll.dll!__RtlUserThreadStart@8()     Unknown
 

To reproduce the bug, I just run the application and let it sit for 5-30 minutes and then the crash will occur.

Any ideas?
« Last Edit: October 22, 2013, 03:38:02 pm by Caeous »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: DInput crash during pollEvent
« Reply #1 on: October 22, 2013, 03:29:20 pm »
Hi

First, you should remove all the irrelevant (OpenGL) code for future tests.

What's your joystick? Have you tried with other models (if possible)?
Laurent Gomila - SFML developer

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: DInput crash during pollEvent
« Reply #2 on: October 22, 2013, 03:30:10 pm »
Thank you for the response. I will make the code even more concise next time. I've updated the main post code.

I do not have a joystick.
« Last Edit: October 22, 2013, 03:37:18 pm by Caeous »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: DInput crash during pollEvent
« Reply #3 on: October 22, 2013, 04:03:24 pm »
Ah, sorry, I saw joyOpen in the call stack and thought SFML was trying to open a joystick, but it's just called internally by joyGetPosEx which checks for available joysticks.

So, forget my previous comment, and... sorry I have no idea why it crashes :-\
Laurent Gomila - SFML developer

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: DInput crash during pollEvent
« Reply #4 on: October 22, 2013, 04:10:53 pm »
Soryy, I know you must be really busy, but do you have any recommendations for something that we could try? We have two computers running with the same version of DirectX (and I guess as a result DInput), but only one of them is crashing. I also have no idea why it's crashing. Both computers have the same hardware configuration.

Merci.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: DInput crash during pollEvent
« Reply #5 on: October 22, 2013, 04:15:02 pm »
I really have no idea.

Do you have other applications/games using DirectInput and/or joysticks that work on your computer?

Maybe you could try to reinstall, repair or even update your version of DirectX?
Laurent Gomila - SFML developer

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: DInput crash during pollEvent
« Reply #6 on: October 22, 2013, 04:41:34 pm »
We're looking into reinstalling DirectX, but last I checked it comes with Windows so there's no way to uninstall it, and the installer doesn't give a repair option.

Anyways, I'm thinking as a last resort it might be a good idea to remove the joystick check? I looked into Window::initialize for any joystick code and I couldn't find any, and the callstack is pretty vague as to where the check is occurring. I figure you might know? Where should I be looking to minimize any Joystick code?

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: DInput crash during pollEvent
« Reply #7 on: October 22, 2013, 06:47:51 pm »
Have you heard of any conflicts with AutoHotkey?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: DInput crash during pollEvent
« Reply #8 on: October 22, 2013, 08:12:06 pm »
You can have a look at sf::priv::WindowImpl, and/or sf::priv::JoystickManager.

Quote
Have you heard of any conflicts with AutoHotkey?
Nop.
Laurent Gomila - SFML developer

Caeous

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: DInput crash during pollEvent
« Reply #9 on: October 25, 2013, 02:27:27 pm »
Laurent,

We found the issue. It's because of a special Watch software that was installed on the computer.

You can download the Watch software here:

http://www.movescount.com/connect/moveslink/Suunto_Ambit

Steps to Reproduce: Run the code in my original post, and run this application software (even when it's asking for the watch, just leave it on).

The crash takes a while to occur, but does nonetheless. I would suggest leaving it overnight.

Do you have any idea why it could be crashing? I'm just worried that other special equipment (like maybe Galaxy Gear, etc) could be crashing in SFML.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: DInput crash during pollEvent
« Reply #10 on: October 25, 2013, 03:37:04 pm »
You didn't answer an important question:

Quote
Do you have other applications/games using DirectInput and/or joysticks that work on your computer?
Laurent Gomila - SFML developer

 

anything