assertion failed on debug
« on: 08 October 2015, 22:21:50 »
Hi
I got a strange debug assertion failed when i use this Tab
Code: [Select]
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.




« Last Edit: 08 October 2015, 23:58:08 by billarhos »

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: Hi
« Reply #1 on: 08 October 2015, 22:28:08 »
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

Re: Hi
« Reply #2 on: 08 October 2015, 23:56:46 »
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

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: assertion failed on debug
« Reply #3 on: 09 October 2015, 13:35:38 »
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?

Re: assertion failed on debug
« Reply #4 on: 09 October 2015, 15:20:45 »
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




Re: assertion failed on debug
« Reply #5 on: 11 October 2015, 11:53:38 »
hi

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

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

thank you

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: assertion failed on debug
« Reply #6 on: 11 October 2015, 13:45:29 »
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).

Re: assertion failed on debug
« Reply #7 on: 11 October 2015, 14:07:54 »

*

texus

  • *****
  • 1143
    • View Profile
    • Texus's Blog
Re: assertion failed on debug
« Reply #8 on: 11 October 2015, 14:55:32 »
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

Re: assertion failed on debug
« Reply #9 on: 11 October 2015, 15:43:21 »
Ok fixed

thanks