From 179a173b3b063a6e9e9807912919b77abbbe5115 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 9 Jan 2023 19:32:09 +0100 Subject: [PATCH] Solve a segfault with piece animations --- src/game_tab/left_panel/GameTabLeftPanel.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index 3304904..5a7877d 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -94,14 +94,16 @@ void GameTabLeftPanel::Notify(bool skip_animation) { // Update capture and check if we should to animations during moves change: if (m){ captures = m->GetLineCaptures(); - if(m->HasParent(last_move)){ - m->GetAbsoluteMove(src,dst); - animate=true; - }else if(m->HasChild(last_move)){ - // Accessing last_move here is safe since it is still - // in the tree of moves (since HasChild found it so not deleted) - last_move->GetAbsoluteMove(dst,src); - animate=true; + if(!m->IsVariation()){ // Animations can lead to segfault when clicking on CGEditor move + if(m->HasParent(last_move)){ + m->GetAbsoluteMove(src,dst); + animate=true; + }else if(m->HasChild(last_move)){ + // Accessing last_move here is safe since it is still + // in the tree of moves (since HasChild found it so not deleted) + last_move->GetAbsoluteMove(dst,src); + animate=true; + } } } else if(game->GetNextMove()){ // First move animation HalfMove *next=game->GetNextMove();