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

Author Topic: [BUG?] 2.0 SFML Text Causing Unhandled Exception in RELEASE compile  (Read 1328 times)

0 Members and 1 Guest are viewing this topic.

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Hello all.

Been hunting down a disguising problem with a game I've written and I gave up and so wrote the game up from the ground again, but this time compiling release at every major stage too.

Well I've hit the error again - this time I've worked out what it is.. sf::text.

if I load a font its fine, but the second I apply it to a sf::text it was crashing on exit.

after an hour of debugging I found the problem... if I set the string inside the sf::text before the font it set, it causes the problem. EG.

        if(!mFont.loadFromFile("Data/Fonts/comic.ttf"))
                std::cout << "Fail to load font.. " << std::endl;
       
        mText.setString("Press Space.");
        mText.setFont(mFont);
        mText.setOrigin(mText.getGlobalBounds().width / 2.0f, mText.getGlobalBounds().height / 2.0f);
        mText.setPosition(this->GetEnginePtr()->GetGraphics()->GetWindow().getSize().x / 2.0f,
                                          this->GetEnginePtr()->GetGraphics()->GetWindow().getSize().y / 2.0f);
        mText.setColor(sf::Color::Blue);
 

that above will cause a release build crash on exit.

        if(!mFont.loadFromFile("Data/Fonts/comic.ttf"))
                std::cout << "Fail to load font.. " << std::endl;

        mText.setFont(mFont);
        mText.setString("Press Space.");
        mText.setOrigin(mText.getGlobalBounds().width / 2.0f, mText.getGlobalBounds().height / 2.0f);
        mText.setPosition(this->GetEnginePtr()->GetGraphics()->GetWindow().getSize().x / 2.0f,
                                          this->GetEnginePtr()->GetGraphics()->GetWindow().getSize().y / 2.0f);
        mText.setColor(sf::Color::Blue);
 

However - the above code will work fine.

I could not find mention in the documentation that the process had to be so strict?

I am using AMD 6990 GFX.
« Last Edit: December 15, 2012, 03:26:18 am by Tally »
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: [BUG?] 2.0 SFML Text Causing Unhandled Exception in RELEASE compile
« Reply #1 on: December 15, 2012, 08:20:01 am »
Have you built SFML on your own or are you still using SFML 2.0RC which is 'known' for crashing due to the default font. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything