SFML community forums

Help => Graphics => Topic started by: lesnoy on February 26, 2019, 10:05:47 am

Title: sf::Shape::setOutlineThickness() function causes program crash
Post by: lesnoy on February 26, 2019, 10:05:47 am
Hi, I'm learning SFML and practicing in creating some GUI elements like buttons. Here I have my Abstract_button class constructor.
//Abstract_button is virtually inherited from sf::Shape so I can call its functions
Abstract_button::Abstract_button()
{
        /*...insignifacant details unrelated to the problem...*/

        setFillColor(style()->normal_fill_color());
        setOutlineColor(style()->normal_outline_color());

        //the following line causes program crash
        setOutlineThickness(style()->normal_outline_thickness());
}
The problem is when I call setOutlineThickness() function from this constructor, program crashes for no obvious reason.
Quote
Unhandled exception at 0x747824CB(ucrtbase.dll) in GUI_element.exe: Fatal program exit requested.
This address is the same every time I run the program.
Calling setOutlineThickness() function from member functions or derived class constructor doesn't cause the crash. Calling similar functions like setFillColor() also doesn't result in any unwanted behavior.
//Rect_button is inherited from my Abstract_button class and sf::RectangleShape
Rect_button::Rect_button(const Point& pos, const Size& size)
        :RectangleShape(size)
{
        setPosition(pos);

        //if I put the following code line into this constructor,
        //program will work without any problems
        setOutlineThickness(style()->normal_outline_thickness());
}
I think I should say that I use a little bit modified version of SFML. I edited source code and rebuilt library so sf::RectangleShape is virtually inherited from sf::Shape. I don't think this might result in crashes but I think I should give this information just in case.
Title: Re: sf::Shape::setOutlineThickness() function causes program crash
Post by: eXpl0it3r on February 26, 2019, 10:22:56 am
Best to use a debugger, find the place it crashes and the call stack.
Title: Re: sf::Shape::setOutlineThickness() function causes program crash
Post by: lesnoy on February 26, 2019, 10:59:06 am
Program crashes exactly in the specific place into the Abstract_button constructor when setOutlineThickness() is called. Unfortunately I have no idea what causes such specific error and debugger can't help me more in that although I know what code causes crash.
Title: Re: sf::Shape::setOutlineThickness() function causes program crash
Post by: eXpl0it3r on February 26, 2019, 11:02:22 am
Without call stack, I also can't pin point any potential locations inside of SFML. ;)
Title: Re: sf::Shape::setOutlineThickness() function causes program crash
Post by: lesnoy on February 26, 2019, 12:56:22 pm
Now I have one more problem. :'( I built .pdb files and put them into the directory with .exe file so I can get
information about SFML function calls, but it seems like Visual Studio doesn't even see these files.
Quote
Frames below may be incorrect and/or missing, no symbols loaded for sfml-graphics-2.dll   
Might it be caused by building project in Release mode? What could I do to fix this?
Title: Re: sf::Shape::setOutlineThickness() function causes program crash
Post by: eXpl0it3r on February 26, 2019, 01:07:51 pm
Run it in debug mode with debug SFML libraries?