From 7685a22c5fb0c5f864b37e17ac60df43078d33cc Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 4 Sep 2023 19:58:55 +0200 Subject: [PATCH] fix: Crash when pressing delete twice when data processor nodes are selected --- .../builtin/source/content/views/view_data_processor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/views/view_data_processor.cpp b/plugins/builtin/source/content/views/view_data_processor.cpp index d9ba8c460..92f8e7024 100644 --- a/plugins/builtin/source/content/views/view_data_processor.cpp +++ b/plugins/builtin/source/content/views/view_data_processor.cpp @@ -988,9 +988,10 @@ namespace hex::plugin::builtin { { const int selectedLinkCount = ImNodes::NumSelectedLinks(); if (selectedLinkCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) { - static std::vector selectedLinks; + std::vector selectedLinks; selectedLinks.resize(static_cast(selectedLinkCount)); ImNodes::GetSelectedLinks(selectedLinks.data()); + ImNodes::ClearLinkSelection(); for (const int id : selectedLinks) { eraseLink(workspace, id); @@ -1002,9 +1003,10 @@ namespace hex::plugin::builtin { { const int selectedNodeCount = ImNodes::NumSelectedNodes(); if (selectedNodeCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) { - static std::vector selectedNodes; + std::vector selectedNodes; selectedNodes.resize(static_cast(selectedNodeCount)); ImNodes::GetSelectedNodes(selectedNodes.data()); + ImNodes::ClearNodeSelection(); this->eraseNodes(workspace, selectedNodes); }