fix: Crash when pressing delete twice when data processor nodes are selected
This commit is contained in:
parent
fc91c8e4b0
commit
7685a22c5f
@ -988,9 +988,10 @@ namespace hex::plugin::builtin {
|
|||||||
{
|
{
|
||||||
const int selectedLinkCount = ImNodes::NumSelectedLinks();
|
const int selectedLinkCount = ImNodes::NumSelectedLinks();
|
||||||
if (selectedLinkCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
|
if (selectedLinkCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
|
||||||
static std::vector<int> selectedLinks;
|
std::vector<int> selectedLinks;
|
||||||
selectedLinks.resize(static_cast<size_t>(selectedLinkCount));
|
selectedLinks.resize(static_cast<size_t>(selectedLinkCount));
|
||||||
ImNodes::GetSelectedLinks(selectedLinks.data());
|
ImNodes::GetSelectedLinks(selectedLinks.data());
|
||||||
|
ImNodes::ClearLinkSelection();
|
||||||
|
|
||||||
for (const int id : selectedLinks) {
|
for (const int id : selectedLinks) {
|
||||||
eraseLink(workspace, id);
|
eraseLink(workspace, id);
|
||||||
@ -1002,9 +1003,10 @@ namespace hex::plugin::builtin {
|
|||||||
{
|
{
|
||||||
const int selectedNodeCount = ImNodes::NumSelectedNodes();
|
const int selectedNodeCount = ImNodes::NumSelectedNodes();
|
||||||
if (selectedNodeCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
|
if (selectedNodeCount > 0 && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete))) {
|
||||||
static std::vector<int> selectedNodes;
|
std::vector<int> selectedNodes;
|
||||||
selectedNodes.resize(static_cast<size_t>(selectedNodeCount));
|
selectedNodes.resize(static_cast<size_t>(selectedNodeCount));
|
||||||
ImNodes::GetSelectedNodes(selectedNodes.data());
|
ImNodes::GetSelectedNodes(selectedNodes.data());
|
||||||
|
ImNodes::ClearNodeSelection();
|
||||||
|
|
||||||
this->eraseNodes(workspace, selectedNodes);
|
this->eraseNodes(workspace, selectedNodes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user