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

Author Topic: My friend is getting errors that i dont get when he closes the program  (Read 3626 times)

0 Members and 1 Guest are viewing this topic.

OutlawLee

  • Jr. Member
  • **
  • Posts: 50
  • This is my personal text. Dont read it.
    • View Profile
    • Email
this is what he gets:
Code: [Select]
the instruction at "0x004f53cc" referenced memory at "0x027581c8". The memory could not be "read". Click on OK to terminate the program
But i close it, it closes normally

while (App.isOpen())
        {
                while (App.pollEvent(Event))
                {
                        if (Event.type == sf::Event::Closed)
                                App.close();
                }
                return 0;
         }
 
« Last Edit: May 11, 2012, 07:33:56 pm by Laurent »

Sonkun

  • Full Member
  • ***
  • Posts: 241
    • View Profile
Lol, look at where your return statement is. "While the window is open, close the program".
Interested in using SFML with Python ? Try out its Python binding!

OutlawLee

  • Jr. Member
  • **
  • Posts: 50
  • This is my personal text. Dont read it.
    • View Profile
    • Email
What ? No i doesnt close since you can write one command after "if" and it will be considered like its in the brackets. Thats not the problem. It runs perfectly on my pc, but on his when he presses exit he gets that error.

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
He didn't said anything about your event and your if statement, he talked about your return. It is inside your while(App.isOpen()) loop. I suppose it's copy mistake, otherwise it would close as soon as it open.

Now for your problem, give us a minimal code. We can't say anything about this.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

OutlawLee

  • Jr. Member
  • **
  • Posts: 50
  • This is my personal text. Dont read it.
    • View Profile
    • Email
oh yeh thats copy paste error, i was writing it manually

Code: [Select]

while (App.isOpen())
{
while (App.pollEvent(Event))
{
if (Event.type == sf::Event::Closed)
App.close();
                        if (Event.type == sf::Event::KeyReleased)
{
if(Event.key.code == sf::Keyboard::Return)
{
if(stage == 0)
{
stage = 1;
loaded = 0;
}
else if(stage == 1)
{
if(menu_choice == 0)
{
stage = 2;
loaded = 0;
}
if(menu_choice == 1)
{

}
if(menu_choice == 2) // This is when he presses exit menu/same goes for the X  sign on the windows bar.
{
App.close();
}
}
}
                        }
}
        }

    return EXIT_SUCCESS;
}

thats it

Im using windows 7, VC++ 2010. Hes still on Win XP SP3.

Im gonna try giving him an empty window program, to see if it works with that one.
« Last Edit: May 12, 2012, 11:50:26 am by OutlawLee »

aNewHobby

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • Live 4 Ever Or Die Trying
is this happening when running from inside VS? try building a release build and running from explorer.. you might find it runs fine. I forget where ... but i saw a post that said there was a bug that caused a crash as the program closed when running from the run command in VS...

The fix as I understand it is to use a custom font rather than the default one... anyway that worked for me when i tried to make a corss project in xciode code::blocks(ubuntu) and Vs2010... in vs2010 the exact same code would crash... simply changed it to laod a custom font and it worked...
Twitter: @Jyinkies
My Own Little Spot on the Net: - Live4everOrDieTrying.info (Blog)

OutlawLee

  • Jr. Member
  • **
  • Posts: 50
  • This is my personal text. Dont read it.
    • View Profile
    • Email
Im building a debug. Im using custom fonts.

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Do you use the custom fonts when you build your sf::Text, or you use default constructor for sf::Text? If so, the default fonts load anyway and can cause the problem. Like I said, give us a minimal code. You just gave us the while loop. Not enough. We don't know what's happening before. You should try to create a minimal code that reproduces the error.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

 

anything