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

Author Topic: Image and Font causes crashes at program exit  (Read 3124 times)

0 Members and 1 Guest are viewing this topic.

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
Image and Font causes crashes at program exit
« on: March 21, 2011, 03:08:41 am »
Let me start off by giving you some info:
OS: Windows 7
Graphics Driver: ATI CCC 10.10
IDE: VS2010
SFML: SFML2.0

Alright, so I can't seem to globally declare an Image or a Font.

For example, I've got a class with a static vector of Images, Fonts, and SoundBuffers, like so:
Code: [Select]

class DataManager
{
private:
static std::vector<sf::Image> imageData;
static std::vector<sf::SoundBuffer> soundData;
static std::vector<sf::Font> fontData;
};


And of course I'm defining the vectors in DataManager's .cpp file.  The problem is that global Images or Fonts give me an unhandled exception when the program closes then tells me the program crashed in crt0dat.c at line 708:
Code: [Select]

void __cdecl __crtExitProcess (
        int status
        )
{
        __crtCorExitProcess(status);

        /*
         * Either mscoree.dll isn't loaded,
         * or CorExitProcess isn't exported from mscoree.dll,
         * or CorExitProcess returned (should never happen).
         * Just call ExitProcess.
         */

        ExitProcess(status); /* 708 */
}


Declaring a SoundBuffer globally works just fine though.

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
Image and Font causes crashes at program exit
« Reply #1 on: March 21, 2011, 05:12:49 am »
It's also happening when I create a RenderWindow.  The program runs perfectly fine but I get that unhandled exception when I exit.  Also, I'm not creating the RenderWindow object globally, it's inside main.

Same problem in MSVC08 too...

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
Image and Font causes crashes at program exit
« Reply #2 on: March 22, 2011, 01:56:47 am »
I've switched back to SFML1.6 and everything works fine.  It's a shame though, I was looking forward to using VS2010. :(

JAssange

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Image and Font causes crashes at program exit
« Reply #3 on: March 22, 2011, 02:16:05 am »
If no error appears in release mode then it's the ATI bug and you can fix it in debug builds with something like this at the end of main:
Code: [Select]
#ifdef DEBUG
TerminateProcess(GetCurrentProcess(),EXIT_SUCCESS);
#endif


(requires including Windows.h for debug builds as well obviously)

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
Image and Font causes crashes at program exit
« Reply #4 on: March 22, 2011, 02:28:24 am »
No error appears in release or debug mode.  It's just that unhandled exception at program exit.

I tried your suggestion with the same results in debug mode.

Besides, I shouldn't be having the ATI bug because my drivers are on the latest working version that's compatible with SFML (10.10e).

 

anything