Archived

This topic is now archived and is closed to further replies.

Direct Input - Debug Assertion Failed

This topic is 5773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, i searched the forum but none could provide a topic for my particular problem (none that i found any way) Using DX8.1, VC++5.0 I Have a window(application) class, which is called and initialized by the main program. This means i have successfully setup a message loop incorporating a static member of the class, with setwindowlong trickery. The window class contains a CPlayer object (the player) and a CInput object. (a direct input wrapper) (amongst other bits and bobs) I am using a timer message to retrieve the keyboard data periodically, and in the handler for WM_TIMER call: window->m_input.getKeyboardInput(); which reads the buffered data from the keyboard into the CInput class (m_Input) I then call window->processKeyboard(); which accesses m_Input to determine if a key has been pressed and then handles it. The Problem. ============ (note big double underline) The program essentially does nothing. Which is good. That is until I handle a key press through processKeyboard(). Then it crashes. crashes and burns. "Debug assertion failed Program: ...app.exe //my exe File: dbgheap.c //not mine Line: 1011 Expression: _CrtlsValidHeapPointer(pUserData) For information on how your program can cause an assertion failure see the VC++ docs on asserts" (abort)(retry)(ignore) This is followed by "illegal operation ... prog shut down" I checked several things, and turns out that even if i call a message box in the WM_TIMER part of my window proc switch, the same occurs. BUT, if i take out the window->processKeyboard() call, the timer succeeds again and again. also, if i press a key that is NOT handled by the above, no crash. if i include the key in the switch handling the individual keys, but no function call, no crash. Can post more code on request, but thought i would give a background first as am working on a different pc, and, well copy paste just not an option Thanks for any insight, will answer any q's Edited by - thehermit on February 21, 2002 11:51:11 AM

Share this post


Link to post
Share on other sites
When it crashes, doesn''t it offer you a ''debug'' button to show you where it crashed in the source code? Either way, you''re probably dereferencing a NULL or invalid pointer somewhere.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

Share this post


Link to post
Share on other sites