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.
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.