Sign in to follow this  

Program crash during doexit()

This topic is 4684 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

So, I've been working on a game for a while and decided to use some XML files as input to the game. Typical stuff. I choose Tinyxml and simply include the tinyxml files into my VC7.0 project and re-compile. Easy pickings! However, now my program always crashes on exit. Here's the stack:
 	ntdll.dll!77f51baa() 	
 	ntdll.dll!77f7561d() 	
>	msvcr71d.dll!_lock_file(void * pf=0x7c38b508)  Line 236	C
 	msvcr71d.dll!fclose(_iobuf * stream=0x7c38b508)  Line 56 + 0x9	C
 	MyProgram.exe!_main()  + 0x1b5	C
 	msvcr71d.dll!doexit(int code=0, int quick=0, int retcaller=0)  Line 376	C
 	msvcr71d.dll!exit(int code=0)  Line 303 + 0xd	C
 	MyProgram.exe!_main()  + 0xe4	C
 	MyProgram.exe!mainCRTStartup()  Line 398 + 0x11	C
 	kernel32.dll!77e8141a() 	

I'm also using SDL. I have not opened any XML files or done anything with tinyxml yet. I simply compiled tinyxml into my program and added #include "tinyxml.h". But msvcr71d.dll!fclose is trying to close a stream with stream->_ptr that is null. Voila trap! stream->_flag is set to _IOWRT (2). Anyone else solve any problem with doexit crashes? I have no idea what's going on here... Cheers! Neil

Share this post


Link to post
Share on other sites
Write up a little hello world program that includes tinyxml and see if it does the same thing. It sounds more like tinyxml just happened to uncover a bug in your code when you included it, but we won't be able to tell for sure until you test it out on some other programs.

Share this post


Link to post
Share on other sites
Quote:
Original post by bytecoder
Write up a little hello world program that includes tinyxml and see if it does the same thing. It sounds more like tinyxml just happened to uncover a bug in your code when you included it, but we won't be able to tell for sure until you test it out on some other programs.


Thanks bytecoder. Yes, I tried that. A simple C++ program which includes tinyxml doesn't crash like this. Also, when I load an XML file in this program, it all works fine.

I think you're right that a problem with my code is being exposed here. I don't understand why including tinyxml.h would make a change in codepath and expose a problem...

Since stream->_flag == _IOWRT, I assume that this is a real file stream. But I'm not yet reading in any files...

In my program, I have put exit( 0 ) at the beginning of main() so that no dynamic allocations are made (and certainly no files are loaded). I still get the crash during doexit.

Share this post


Link to post
Share on other sites

This topic is 4684 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this