Imgui: Where to look for error? Assertion: g.CurrentTabBar == NULL, fixed by opening Examples -> Documents

Created on 23 Feb 2019  路  5Comments  路  Source: ocornut/imgui

Version/Branch of Dear ImGui:

Version: 1.69 WIP
Branch: docking (87ded34f9f7f13f99130c171632bc8e21b857d62)


Dear ImGui 1.69 WIP (16899)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=199711
define: _WIN32
define: _WIN64
define: _MSC_VER=1900
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000041
 NavEnableKeyboard
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.BackendFlags: 0x00001406
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,512
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

My Issue/Question:

A few information:

  • I am not new to ImGui, but I decided to switch to the docking branch to try out the new docking feature, but for some reason I encoutered a failed assertion in the first seconds of playing around.
  • My application setup is basically the same as examples/example_glfw_opengl3/main.cpp, I have verified it numerous times and I cannot spot a single meaningful difference between my setup and the example.
  • I use glad instead of gl3w, but this hopefully shouldn't make a difference.
  • I use the Visual Studio 2015 compiler.
  • I recompiled ImGui using the docking branch (commit 87ded34f9f7f13f99130c171632bc8e21b857d62).
  • I removed all my ImGui windows except for the new demo window from imgui_demo.cpp.
  • I also removed the old imgui.ini file so that ImGui can generate a new one.
  • The official example works fine (examples/example_glfw_opengl3/main.cpp). Therefore the bug is certainly somewhere in my code but I have no idea where to look as I am a newbie in this new docking.

Now the bug:

1) I run the application, only the Demo window is shown.
2) I open the Examples -> Log window or any other basic window.
3) I drag&drop the Log window over the Demo window to dock it (does not matter how exactly).
4) Assertion failed: g.CurrentTabBar == 0, file imgui\imgui_widgets.cpp, line 6272
5) Note: This bug can be "magically" fixed by opening the Examples -> Documents window which uses docking in itself.

image

image

bug docking

All 5 comments

Hello @tomasiser and thank you for the detailed report.
I have changed this code precisely yesterday, so I expect this could be a bug (I suspected the assert could have been invalid when Docking is active but couldn't find a repro when I tried yesterday).
I'll look into it now.

Oh geez, the value is uninitialized so using docking before tab bar will trigger the assert.

You can add:

In ImGuiContext() constructor you can add:

CurrentTabBar = NULL;

Best if you can confirm on your side. Will commit this shortly along with other stuff.

I've been running PVS-Studio from time to time but not on a daily basis.

image

I will look into wiring it into the command-line so I can have it run more frequently.

Woah, thanks a lot! That certainly fixed the bug! I wonder why the assert did not fail in the official example which is compiled in Debug?

Thank you for the head-up! (note that it is not merged in Docking yet, will be in a few hours, you can keep your uncommitted local fix until then).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mnemode2 picture mnemode2  路  3Comments

dowit picture dowit  路  3Comments

GrammarLord picture GrammarLord  路  3Comments

inflex picture inflex  路  3Comments

ghost picture ghost  路  3Comments