assertion failed on debug

Started by billarhos, 08 October 2015, 22:21:50

billarhos

Hi
I got a strange debug assertion failed when i use this Tab

Tab
{
    BackgroundColor : rgba(180, 180, 180, 215);
    SelectedBackgroundColor : rgba(0, 110, 200, 130);
    TextColor : rgba(255, 255, 255, 215);
    SelectedTextColor : rgba(255, 255, 255, 245);
    BorderColor : rgba(240, 240, 240, 215);
    Borders : (1, 1, 1, 1);
}


The strange here is that when i run in release it is working just fine.
The assertion is in debug.





texus

This is probably due to some incompatibility in some library or settings, especially because you mention that it works fine in release mode. Check the things mentioned in this post: https://forum.tgui.eu/index.php?topic=216.msg1092#msg1092

billarhos

Hi and Thanks
I do not believe i got a compatibility issue but i am not quite sure. I will check tomorrow.

I use dynamically linking and double check about debug and release libs and dlls
I am using community Visual Studio 2013

The error occur on this line "pWindow->add(pTab)" with the code on the first question.
If i use an empty png file and this lines
NormalImage       : "White.png" Part(0, 0, 60, 32) Middle(16, 0, 28, 32);
SelectedImage     : "White.png" Part(0, 32, 60, 32) Middle(16, 0, 28, 32);

then i got no error both in release and debug mode.





texus

There are a few things you could check.
- So the debug settings link against the sfml and tgui libraries ending with "-d"?
- Are u using the precompiled tgui libraries or did you compile tgui yourself?
- Print pTab right before calling add to make sure it isn't a nullptr.
- Could you show the exact code that you are using (preferably just a simple main function)?
- Could you get a call stack of when the assertion happens?

billarhos

Well

yes there is no linking problem. I link against the correct libs (debug with -d)
I compile tgui myself.
pTab is not a null pointer.
I will make a simple example and upload it to mediafire in this weekend (hold on)
Yes i get a call stack if i press retry button and the line that stops is : pGui->add(pWindow);

pGui is a "tgui::Gui *" and  pWindow is a "tgui::ChildWindow::Ptr"

i was wrong about "pWindow->add(pTab)"

As i said before if i remove  BackgroundColor and SelectedBackgroundColor from txt file and replace them with NormalImage and SelectedImage the i have no error.

thanks




billarhos

hi

i made a simple repro project. I include all necessary files in order to compile and run.

you can download from here: https://www.mediafire.com/download/sgndoqcbnhg6h2p/SfmlTest.zip

thank you

texus

When you build tgui there should have been more files inside the build folder next to the .lib files (some .pdb files). Could you send these files too? I can reproduce the crash here but I can't debug it without these pdb files. Without those files I would have to replace all sfml and tgui libraries which could take some time (since I don't normally work on windows).


texus

For some reason it didn't want to load the pdb file so I ended up just adding all tgui cpp files directly in the project to debug it.

The "bug" seems to be that I loop over a list of textures even though no textures are loaded. The code did not give problems on any other platform or in release mode because the iterators are not used when no textures are loaded. But they were still being incremented even when invalid which visual studio checks in debug mode.

Source code for fixed version can be found on github: https://github.com/texus/TGUI

billarhos