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

Author Topic: sf::Shape::setOutlineThickness() function causes program crash  (Read 1384 times)

0 Members and 1 Guest are viewing this topic.

lesnoy

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
sf::Shape::setOutlineThickness() function causes program crash
« 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: sf::Shape::setOutlineThickness() function causes program crash
« Reply #1 on: February 26, 2019, 10:22:56 am »
Best to use a debugger, find the place it crashes and the call stack.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

lesnoy

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: sf::Shape::setOutlineThickness() function causes program crash
« Reply #2 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: sf::Shape::setOutlineThickness() function causes program crash
« Reply #3 on: February 26, 2019, 11:02:22 am »
Without call stack, I also can't pin point any potential locations inside of SFML. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

lesnoy

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: sf::Shape::setOutlineThickness() function causes program crash
« Reply #4 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: sf::Shape::setOutlineThickness() function causes program crash
« Reply #5 on: February 26, 2019, 01:07:51 pm »
Run it in debug mode with debug SFML libraries?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything