This function cause the segfault :
void SFMLDisplayManager::displayButton(TextElem const &button)
{
sf::RectangleShape buttonShape(sf::Vector2f(button.sizeX, button.sizeY));
sf::Text shapeText;
ConvertColor convert;
convert.color = button.color;
if (button.text != "")
{
shapeText.setCharacterSize(button.FontSize);
shapeText.setFont(this->_font);
shapeText.setPosition(button.pos.x, button.pos.y);
shapeText.setColor(sf::Color::Red);
shapeText.setString(button.text);
std::cout << "before" << std::endl;
this->_window->draw(shapeText);
std::cout << "after" << std::endl;
}
buttonShape.setFillColor(sf::Color(convert.colors.r, convert.colors.g, convert.colors.b, convert.colors.t));
buttonShape.setPosition(button.pos.x , button.pos.y);
this->_window->draw(buttonShape);
}
And I use it a lot to draw differents other things. I even send the same button, but at the start of my program and it works fine. My valgrind is empty,I just go a
==17529== Jump to the invalid address stated on the next line
==17529== at 0x5CD1E: ???
==17529== Address 0x5cd1e is not stack'd, malloc'd or (recently) free'd
==17529==
when the segfault occure.
If a run it with gdb I got
0x00007ffff5a5f645 in FT_Render_Glyph_Internal () from /lib64/libfreetype.so.6
When I print all the information of button, all information are good.
Have any idea why it segfaults ?
Aucun commentaire:
Enregistrer un commentaire