From eb1b2f85d8630b06f8e711836c0dee8f16921da5 Mon Sep 17 00:00:00 2001 From: thedmd Date: Tue, 19 Sep 2023 08:57:14 +0200 Subject: [PATCH] Editor: Don't call Reasume/Suspend on invisible canvas (#255) --- docs/CHANGELOG.txt | 2 ++ imgui_node_editor.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index e0e41196..d8a8512e 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -8,6 +8,8 @@ v0.10.0 (WIP): BUGFIX: Canvas: Ensure SentinelDrawCallback cleanup (#255) + BUGFIX: Editor: Don't call Reasume/Suspend on invisible canvas (#255) + v0.9.2 (2023-09-01): diff --git a/imgui_node_editor.cpp b/imgui_node_editor.cpp index 267d77bc..2adf0279 100644 --- a/imgui_node_editor.cpp +++ b/imgui_node_editor.cpp @@ -1965,7 +1965,8 @@ void ed::EditorContext::Suspend(SuspendFlags flags) IM_ASSERT(m_DrawList != nullptr && "Suspend was called outiside of Begin/End."); auto lastChannel = m_DrawList->_Splitter._Current; m_DrawList->ChannelsSetCurrent(m_ExternalChannel); - m_Canvas.Suspend(); + if (m_IsCanvasVisible) + m_Canvas.Suspend(); m_DrawList->ChannelsSetCurrent(lastChannel); if ((flags & SuspendFlags::KeepSplitter) != SuspendFlags::KeepSplitter) ImDrawList_SwapSplitter(m_DrawList, m_Splitter); @@ -1978,7 +1979,8 @@ void ed::EditorContext::Resume(SuspendFlags flags) ImDrawList_SwapSplitter(m_DrawList, m_Splitter); auto lastChannel = m_DrawList->_Splitter._Current; m_DrawList->ChannelsSetCurrent(m_ExternalChannel); - m_Canvas.Resume(); + if (m_IsCanvasVisible) + m_Canvas.Resume(); m_DrawList->ChannelsSetCurrent(lastChannel); }