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

Author Topic: Text.setString("") crashes on mac  (Read 2186 times)

0 Members and 1 Guest are viewing this topic.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Text.setString("") crashes on mac
« on: March 31, 2012, 02:08:40 pm »
I noticed that calling Text.setString with an empty string gives my a SIGABRT.
However, when passing '\0' instead of "" it worked correctly.

The SIGABRT comes from "/usr/include/c++/4.2.1/ext/new_allocator.h" on line 97, which is the deallocate function.

I am working on Mac OS X Lion with Xcode 4.3.2.
TGUI: C++ SFML GUI

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text.setString("") crashes on mac
« Reply #1 on: March 31, 2012, 07:00:22 pm »
Laurent Gomila - SFML developer

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: Text.setString("") crashes on mac
« Reply #2 on: March 31, 2012, 07:12:12 pm »
It is indeed the same bug.
I forgot to look at the bug tracker, I only quickly searched on the forum.
Thanks for pointing me to the right place.
TGUI: C++ SFML GUI

MonkeyKnight

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Re: Text.setString("") crashes on mac
« Reply #3 on: May 02, 2012, 05:53:39 pm »
Texus,

What I have done is extend the sf::Text class, and add setString("something"); in the destructor. There may be some pitfalls, and I understand it s a hack. But it is a workaround that has been seeming to work until the actual bug is fixed.

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: Text.setString("") crashes on mac
« Reply #4 on: May 02, 2012, 07:17:30 pm »
It would be better not to use such a hack.
The current workaround "Add -D_GLIBCXX_FULLY_DYNAMIC_STRING=1 to CMAKE_CXX_FLAGS" is better in my opinion.
TGUI: C++ SFML GUI