Troubles with ListBox[Solved]
« on: 15 August 2014, 07:35:39 »
If I add a  ListBox like this, I end up with a crash upon calling tgui::Gui::draw()

Code: [Select]
tgui::ListBox::Ptr textures_listBox(gui,"Textures List");

textures_listBox->load("graphics/gui/Black.conf"); // Load is returning true
sf::Vector2i screenSize(sf::VideoMode::getDesktopMode().width,sf::VideoMode::getDesktopMode().height);
textures_listBox->setPosition(screenSize.x - 200, 0);
textures_listBox->setSize(200,screenSize.y);
textures_listBox->addItem("Test Item");

Tgui version 0.6

SFML Version, the one shipped with this version of Tgui

IDE - Visual Studio 2012

The gui has a window set to it

load("graphics/gui/Black.conf") is returning true


All other widgets I use are working fine, it's just ListBox that doesn't seem to behave.

When it reaches gui.draw(), I get this

Unhandled exception at 0x5DA942EF (sfml-graphics-2.dll) in Aeldyr Editor.exe: 0xC0000005: Access violation reading location 0x4491C004.

I apologize, I'd have done a bit more research on this but there's very little documentation for ListBox. I've tried a variety of things and I keep getting this access error.
« Last Edit: 15 August 2014, 22:27:34 by Austin J »

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #1 on: 15 August 2014, 10:37:39 »
And you are 100% sure that you are linking tgui in the same way as sfml? (both dynamic or both static, both release in release mode and both debug in debug mode).

If so then could you send me your project file(s)?

Re: Troubles with ListBox
« Reply #2 on: 15 August 2014, 13:51:23 »
Yeah, I'm linking dynamically to both. I guess I'll have to send them to you.

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #3 on: 15 August 2014, 14:04:07 »
I just need the vcxproj file. If your code is just a single file then you can send that as well.

Those files should even be small enough to be added as an attachment to your post.

Just to be sure, you have v0.6.5, right?

Re: Troubles with ListBox
« Reply #4 on: 15 August 2014, 19:58:10 »
I'll send the project file, not the code unless we think we need it to solve this issue though because it's an actual project. It's a map editor for a game, so there is a bit of a codebase. (Not that big just not small enough to throw on here ;) - )

I'm using version 0.6, I think I started using it with this before you got version 0.6.5 out.


*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #5 on: 15 August 2014, 20:02:18 »
The library paths in release mode seem right, but the ones in debug mode are wrong.

Code: [Select]
C:\SFML 2.1 -32\SFML-2.1\libShould be
Code: [Select]
C:\TGUI-0.6\lib\SFML
Oh, and the include directory doesn't need "C:\TGUI-0.6\include\SFML". But that doesn't really matter.

Edit: I now see that the include directory in debug mode is also set to the wrong sfml version.

So unless you were experiencing the crash in release mode, it should be solved after changing library and include paths.
« Last Edit: 15 August 2014, 20:04:25 by texus »

Re: Troubles with ListBox
« Reply #6 on: 15 August 2014, 20:09:19 »
Yeah sorry, I should have mentioned originally I was using the wrong SFML versions, so I switched to the versions you shipped out for release mode, I didn't change it in debug. In release mode this problem is occurring.

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #7 on: 15 August 2014, 20:14:10 »
I'm going to have a look if I can reproduce it.

In the meantime you can change your settings to also work in debug, and revert the order of the libraries (first system, then window, ..., finally tgui). And then rebuild the project. Just to be sure that neither of these things influence the crash.

Re: Troubles with ListBox
« Reply #8 on: 15 August 2014, 20:22:32 »
Changed the settings to as you said and sadly no fix  :'(

I've also discovered gui.draw() causes a crash if I add a MenuBar to the gui.

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #9 on: 15 August 2014, 20:32:49 »
Are u perhaps still using the dlls of the old sfml version?

The crash really indicates that there is some incompatibilities in the libraries.
TGUI v0.6.5 has just been build and thus not yet tested, but if you really have v0.6.4 (search PATCH_VERSION in CMakeLists.txt to be sure) then it can't really be a mistake on my side.
« Last Edit: 15 August 2014, 20:35:30 by texus »

Re: Troubles with ListBox
« Reply #10 on: 15 August 2014, 22:22:01 »
That thought had actually come to mind when I was changing the debug settings, and after getting some confirmation from reading your response there I went ahead and replaced the dlls. Sure enough everything seems to be working fine now. I completely wasted your time there, apologies sir, I don't know why I didn't use the dlls you shipped in the first place. Thank you for your patience!

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Troubles with ListBox
« Reply #11 on: 15 August 2014, 22:27:49 »
Its ok, you can't help it that windows is such a pain to develop with :).
The smallest mistake leads to strange crashes, and its always hard to find out which mistake you made.