Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/nbl/ext/ImGui/ImGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nbl/ext/ImGui/ImGui.h"
#include "nbl/ext/ImGui/builtin/hlsl/common.hlsl"
#include "imgui/imgui.h"
#include "imgui/imgui_internal.h"
#include "imgui/misc/cpp/imgui_stdlib.h"

#ifdef NBL_EMBED_BUILTIN_RESOURCES
Expand Down Expand Up @@ -948,14 +949,20 @@ UI::UI(SCreationParameters&& creationParams, core::smart_refctd_ptr<video::IGPUG
UI::~UI()
{
// I assume somebody has not killed ImGUI context & atlas but if so then we do nothing
auto* const context = reinterpret_cast<ImGuiContext*>(m_imContextBackPointer);
ImGuiContext* const previousContext = ImGui::GetCurrentContext();
if (context && previousContext != context)
ImGui::SetCurrentContext(context);

// we must call it to unlock atlas from potential "render" state before we kill it (obvsly if its ours!)
if(m_imFontAtlasBackPointer)
if (m_imFontAtlasBackPointer && context && context->WithinFrameScope)
ImGui::EndFrame();

// context belongs to the instance, we must free it
if(m_imContextBackPointer)
ImGui::DestroyContext(reinterpret_cast<ImGuiContext*>(m_imContextBackPointer));
if (context)
ImGui::DestroyContext(context);
if (previousContext && previousContext != context)
ImGui::SetCurrentContext(previousContext);

// and if we own the atlas we must free it as well, if user passed its own at creation time then its "shared" - at this point m_imFontAtlasBackPointer is nullptr and we don't free anything
if (m_imFontAtlasBackPointer)
Expand Down
2 changes: 1 addition & 1 deletion tools/nsc/manifests/nsc-windows-x64-release.tag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nsc-windows-x64-release-29bda527be490f8214e937ae33bbffd438cce6e6
nsc-windows-x64-release-eb1bc723b1159029c572f5bf539dafeea03bbbcc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: f739d206ca9055781c891f130c6ebc1b
size: 1311
- md5: 27b41f54ba2fbed4e8a0c507e3efb152
size: 1337
hash: md5
path: build-info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: c4bb7179384f8fe59a5706751a2ef473
- md5: 2f6ac2e50fe11b36b5a426bcb3b3fa3a
size: 258048
hash: md5
path: nsc.exe
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: 862b11b94cb23c8bac2a20a215eb6597
size: 21601280
- md5: 2f88a872e7e2c9b1c07683f265559b05
size: 21609472
hash: md5
path: dxcompiler.dll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: 5edb2790e9ceae424e3c0a04e3d84718
size: 29212672
- md5: f3efa28ec945dae71bf6bbe34331d8ca
size: 29222400
hash: md5
path: Nabla.dll
Loading