开发者

dbgrptt.c dbghook.c Iterator Error?

开发者 https://www.devze.com 2023-01-14 12:19 出处:网络
Okay, so long weekend away with Macb开发者_JS百科ook I started making an asset loader for 2D game platforms, its working fine in xcode, but when I got home and tried and load it up on Windows I get a

Okay, so long weekend away with Macb开发者_JS百科ook I started making an asset loader for 2D game platforms, its working fine in xcode, but when I got home and tried and load it up on Windows I get a debug error.

Essentially what is happening is that the first call to the iterator works? the second doesn't, but only on the second attempt at calling the second one will it cause the error (this is in a game loop). I've swapped the calls but the same result happens.

The program (in debug) quits and gives me the message

AssetLoadingWin.exe has triggered a breakpoint

then points to the following code in dbgrptt.c

#undef _CrtDbgBreak

/* These methods don't need a separate
   wchar version. Hence they need to be compiled only once from
   the original file */

_CRTIMP void _cdecl _CrtDbgBreak(
    void
    )
{
    DebugBreak(); // <-- breakpoint here
}

if I let it continue i get the following message

Microsoft Visual Studio C Runtime Library has detected a fatal error in AssetLoadingWin.exe.

Press Break to debug the program or Continue to terminate the program.

which in turn points to the code in dbghook.c

__declspec(noinline)
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
    /* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */
    (_Reserved);
    _debugger_hook_dummy = 0;
}

After alot of breakpoints Its been narrowed down to an iterator calling a method.

// line 347 in the pastie.
void libImageDraw(GraphicIt &gfxIt, GraphicOptions &opts) {
    gfxIt->second->draw(opts.x, opts.y, opts.z); line
}

Thanks for any pointers.

Full Source Code

window.cpp

asset_manager.hpp


It looks like you don't check the result of the find call on line 239 in the drawGraphic function.

Also i think the loadAll loop looks dodgy. You're looping over m_assetsToLoad and modifying it at the same time in loadResource.

0

精彩评论

暂无评论...
验证码 换一张
取 消