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

Author Topic: [SOLVED] Program Crashes On Close  (Read 2214 times)

0 Members and 1 Guest are viewing this topic.

Cl9

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
[SOLVED] Program Crashes On Close
« on: July 04, 2014, 12:52:48 am »
Hey, recently I've been writing a fairly small game. I wanted to start writing bits of the GUI and so I wrote a small class which just printed out some text, everything was fine and the program ran without errors (this was yesterday I wrote the class), but today however, when the program closes I keep getting a stopped responding message from Windows. I used the debugger and the errors looked like they were related to the sf::Font class and so I just removed two lines which were:
Code: [Select]
    sf::Font font;
    if(!font.loadFromFile("font.ttf"))
        cout << "\nFailed to load a font!" << endl;

Removing these two lines removed all of the errors and the program ran smoothly again. I obviously need text for a GUI and so I'd really like to know what's going on...?

Build Log:
Code: [Select]
-------------- Clean: Debug in Game (compiler: GNU GCC Compiler)---------------

Cleaned "Game - Debug"

-------------- Build: Debug in Game (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -g -Os -std=c++0x -IC:\Users\Name\Desktop\SFML-2.0\include -Iinclude -c C:\Users\Name\Desktop\Game\Game\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\Users\Name\Desktop\SFML-2.0\lib -o bin\Debug\Game.exe obj\Debug\main.o   -lsfml-system -lsfml-window -lsfml-graphics -lsfml-network -lsfml-audio
Output file is bin\Debug\Game.exe with size 804.23 KB
Process terminated with status 0 (0 minute(s), 11 second(s))
0 error(s), 0 warning(s) (0 minute(s), 11 second(s))


Debugger Log:

Code: [Select]
#0 669A1D1B FT_Done_Library() (C:\WINDOWS\SysWOW64\sfml-graphics-2.dll:??)
#1 669AA61C FT_Done_FreeType() (C:\WINDOWS\SysWOW64\sfml-graphics-2.dll:??)
#2 66981CE4 sf::Font::cleanup() () (C:\WINDOWS\SysWOW64\sfml-graphics-2.dll:??)
#3 0000000B ?? () (??:??)
#4 8F0D76C3 ?? () (??:??)
#5 691C1CFD sf::GlResource::~GlResource() () (C:\WINDOWS\SysWOW64\sfml-window-2.dll:??)
#6 8F0B630A ?? () (??:??)
#7 0028FB58 ?? () (??:??)
#8 00401413 __mingw_CRTStartup() (../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:254)
#9 00401585 mainCRTStartup() (../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:272)


And I get a message from Code::Blocks:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.

Computer Specs:

OS: Windows 8.1 64Bit
Compiler: GCC MinGW
Graphics Card: AMD Radeon 6600M and 6700M Series, AMD Radeon HD 6520G


The code runs fine appart from the errors, and the text displays. I've tried two different font files,re-downloaded the SFML DLL's, re-downloaded SFML and rebuilt the whole project to no avail.The SFML version I am running is the dynamic pre-compiled MinGW 4.7 version... help...? :3
« Last Edit: July 04, 2014, 03:44:12 pm by Cl9 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Program Crashes On Close
« Reply #1 on: July 04, 2014, 08:14:02 am »
Do you use global variables, especially ones related to SFML?

It would be best to provide a complete but minimal example.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Cl9

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Re: Program Crashes On Close
« Reply #2 on: July 04, 2014, 03:43:51 pm »
Never mind... I fixed it. The animation class was bugged and was drawing things which shouldn't exist (not entirely sure why but I re-wrote a few things) and causing it to crash.

EDIT: It was trying to draw a pointer to a texture which no longer existed.

Thanks - Cl9.
« Last Edit: July 05, 2014, 04:01:57 pm by Cl9 »

 

anything