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

Author Topic: Memory Access Violation After Calling App.Close();  (Read 2067 times)

0 Members and 1 Guest are viewing this topic.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Memory Access Violation After Calling App.Close();
« on: September 05, 2010, 04:17:07 pm »
Hello,

I am new to SFML (just switched over from SDL) and programming in general, so this might be a pretty stupid question, but here it goes:

I tried code from the Window Events as well as the Window Creation tutorials, but while running either of them I get:

Code: [Select]
Unhandled exception at 0x6903a39d in ThingThingSFML.exe: 0xC0000005: Access violation reading location 0x00000054.

I narrowed down the code to:

Code: [Select]
#include <SFML/Window.hpp>

int main()
{
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
App.Close();

    return EXIT_SUCCESS;
}


yet I still get the same error. It opens a window perfectly, but it gets a memory access violation when Close(); is called. All other examples that do not use the Window class seem to work fine. I was using SFML2.0, so I tried the same with SFML1.6 with no luck (same error)

Compiler: VS2010

I linked to the dynamic versions of the libraries. I tried using sfml-main as well, I can't see how that could possibly make a difference anyways.

What could possibly cause this error?

Thank you for any help you can offer!
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32436
    • View Profile
    • SFML's website
    • Email
Memory Access Violation After Calling App.Close();
« Reply #1 on: September 05, 2010, 07:22:35 pm »
Remember to link to the debug libraries (with -d suffix) when you compile in debug mode.
Laurent Gomila - SFML developer

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Memory Access Violation After Calling App.Close();
« Reply #2 on: September 05, 2010, 07:29:07 pm »
I did that, I tried it on both debug and release modes. Both give the same error. Like I said, it runs, but it dies on Close();

Debug:

sfml-main-d.lib
sfml-window-d.lib

Release:

sfml-main.lib
sfml-window.lib

All of the DLL's are in the project folder, and I defines the SFML_DYNAMIC macro under Preprocessor.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32436
    • View Profile
    • SFML's website
    • Email
Memory Access Violation After Calling App.Close();
« Reply #3 on: September 05, 2010, 07:32:27 pm »
Do you have an ATI graphics card?
Laurent Gomila - SFML developer

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Memory Access Violation After Calling App.Close();
« Reply #4 on: September 05, 2010, 07:41:53 pm »
Yes, I do.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32436
    • View Profile
    • SFML's website
    • Email
Memory Access Violation After Calling App.Close();
« Reply #5 on: September 05, 2010, 08:30:54 pm »
Ok, so it's a known bug that I have to fix.
Laurent Gomila - SFML developer

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Memory Access Violation After Calling App.Close();
« Reply #6 on: September 26, 2010, 03:21:52 pm »
I discovered that the access violation actually comes from the window's destructor, not Close(); after attempting to get this to work again after some time.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Memory Access Violation After Calling App.Close();
« Reply #7 on: September 26, 2010, 10:09:49 pm »
You're using Visual Studio 2010, so you need to recompile SFML from source.
I use the latest build of SFML2

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
Memory Access Violation After Calling App.Close();
« Reply #8 on: September 27, 2010, 03:02:18 am »
I did, I am using SFML2 so I was sort of forced to anyways. I just opened the VC2008 project and VC2010 automatically converted it allowing me to recompile it for 2010 (I generated both both debug and release versions). To make certain I was using the correct .dll's, I checked their "last edited" dates and saw they were the same as the time I recompiled it. Everything else in SFML runs except the windows destructor.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.