Crash when creating a widget from a theme selector
« on: 05 May 2018, 21:54:13 »
Hello!

I've been trying for the last 2 days to make TGUI work, but It seems to crash whenever I try to create() a widget using a theme "selector".

This doesn't crash, and it throws no exception. I checked that the file exists and is accesible.
Code: [Select]
tgui::Theme::Ptr theme = tgui::Theme::create("../Black.txt");

This however crashes, but throws no exception at all.
Code: [Select]
tgui::MenuBar::Ptr menu = theme->load("MenuBar");
Even the FullExample.cpp won't compile.

Is there something I'm missing?

*

texus

  • *****
  • 1254
    • View Profile
    • Texus's Blog
Re: Crash when creating a widget from a theme selector
« Reply #1 on: 05 May 2018, 22:13:40 »
I can't immediately think of a reason why it wouldn't work.

tgui::Theme::create doesn't actually do anything, so even if the file doesn't exist it won't fail until the first load call. Did you try creating it with an absolute path?
Did you try to catch a tgui::Exception? Did you also try with a "catch (...)" block?
What compiler are you using? Did you download the precompiled libraries for SFML and TGUI for that compiler or did you build them yourself?

Quote
Even the FullExample.cpp won't compile.
Won't compile? If it really doesn't compile then you should show the compile errors.

Re: Crash when creating a widget from a theme selector
« Reply #2 on: 05 May 2018, 23:04:37 »
I'm sorry, the example will compile and it will run but it will crash as soon as it reaches the theme->load("selector").

I tried using an absolute path (saw the tip in another post) and it still crashes at the same point. At this moment I dropped my project and I'm using the fullExample.cpp provided in examples to try and isolate the problem. In the same folder there is the black.txt and the RedBackround.png. I'm pointing towards them using "../Black.txt" and "../RedBackground.jpg". The bg is found for sure. The whole example has a big try block around it and it still doesn't print anything.

I am using GCC 6.3.0 and I used the precomiled versions of both SFML and TGUI.

TGUI came from "TGUI-0.7.7-mingw-6.1.0-32bit-for-SFML-2.4.2"
SFML came from "SFML-2.4.2-windows-gcc-6.1.0-mingw-32-bit"

TGUI runs fine if I do anything else, but it seems to crash at this specific call.

*

texus

  • *****
  • 1254
    • View Profile
    • Texus's Blog
Re: Crash when creating a widget from a theme selector
« Reply #3 on: 05 May 2018, 23:19:20 »
There is only one reason that I know that could cause weird crashes: using incompatible libraries and compiler versions (which is why I asked which versions you were using). If you didn't make a typo and are using GCC 6.3.0 then I suggest you try building TGUI yourself or switch to GCC 6.1.0 in the hope that it fixes the issue. Also make sure you aren't mixing debug and release libs.
Did you try with a different theme (e.g. BabyBlue.txt)?

Edit: if none of this works then I can't do much. You could give 0.8 a try though, it works in a different way and may work.
« Last Edit: 05 May 2018, 23:22:18 by texus »

Re: Crash when creating a widget from a theme selector
« Reply #4 on: 05 May 2018, 23:47:30 »
Just tried with another theme, it makes no difference. I'll try downgrading and post results. Thanks for the assistance!