Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TGUI-0.6.5 (and the latest revision) crashes with SFML 2.1 #29

Closed
danyalzia opened this issue Sep 19, 2014 · 5 comments
Closed

TGUI-0.6.5 (and the latest revision) crashes with SFML 2.1 #29

danyalzia opened this issue Sep 19, 2014 · 5 comments

Comments

@danyalzia
Copy link

Hi,

I downloaded TGUI-0.6.5 and compiled/installed it on Linux (Ubuntu) with SFML 2.1. The examples compiled successfully too, however, they give segmentation fault. The following is the minimal example that fails (assuming sansation.ttf is in same directory):

#include <TGUI/TGUI.hpp>

int main() {
    sf::RenderWindow window(sf::VideoMode(800, 600), "Window");
    tgui::Gui gui(window);

    gui.setGlobalFont("sansation.ttf");

    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }
}

Running through gdb gives the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
0xb7f71eff in tgui::Gui::draw(bool) () from /usr/local/lib/libtgui.so.0.6.5
(gdb) bt
#0  0xb7f71eff in tgui::Gui::draw(bool) () from /usr/local/lib/libtgui.so.0.6.5
#1  0x08049324 in main ()

I commented out gui.draw(); and it runs fine, so something is wrong with that. I cloned latest TGUI branch, but same results, although I didn't try it with latest SFML branch because I assumed it should work with stable SFML version, so maybe the current branch isn't compatible with SFML 2.1?

@GabrieleFrau
Copy link

I would suggest to update SFML anyway, although 2.1 is marked as release, the master branch is more stable even in the devs' opinion.

@texus
Copy link
Owner

texus commented Sep 19, 2014

This is honestly the first time I see a crash on linux. When I saw the description I thought this was once again a binaray incompatibility, but that is a problem with windows.

I will see if I can reproduce the crash.
Which ubuntu version are u using? (in case it won't crash on mine)

But in the meantime you can just use the latest sfml version. There is actually no reason not to use it, since it is indeed more stable than sfml 2.1.

git clone https://github.com/LaurentGomila/SFML
mkdir SFML/build
cd SFML/build
cmake ..
make -j4
sudo make install

@danyalzia
Copy link
Author

Never mind. With the latest SFML version, the examples work as expected, so it is true that current branch isn't compatible with SFML 2.1. Thor also required latest branch, so they explicitly mentioned it on their website. Apparently, there have been several changes in ABI so it's hard to support both versions. I think it needs to be mentioned in TGUI's site too.

I thought latest branch of SFML might have an API incompatibility with 2.1, so I was reluctant to update as I have several toy projects written with SFML 2.1, but it seems there hasn't been any API changes lately -- which is good for me!

Ubuntu's version is 14.01 LTS. You can reproduce the crash with SFML 2.1.

@texus
Copy link
Owner

texus commented Sep 19, 2014

It doesn't crash on my linux mint 17 (which is if I am correct based on ubuntu 14.04).

The reason why Thor requires the latest version is probably the same reason why tgui v0.7-dev requires the latest version: it uses functions that were not in sfml 2.1 yet.

I'm not going to put a notice on my site that it doesn't work with sfml 2.1, because it does. It works on windows, on my linux mint and on my arch linux. It just doesn't work on your linux for some reason.

If you want to continue with finding the error then you might want to build the debug library of tgui so that you at least get a line number of the crash inside the draw function.
But I'm not really sure if it is really worth the effort.

@danyalzia
Copy link
Author

Yes, it's not worth the effort as it works on others' linux as you said. It maybe that 2.1 had some driver-specific bug which caused crash on draw function as it magically fixes for me by just replacing 2.1 with latest. If another user report a crash on linux, you can anyway refer to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants