aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-09 19:32:09 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-09 19:32:09 +0100
commit179a173b3b063a6e9e9807912919b77abbbe5115 (patch)
treefacd211736ba1861f0902564765911168e3c4347
parent8e83bfb673b169eed34db8ac75b8f0ced49c83ea (diff)
Solve a segfault with piece animations
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp18
1 files 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();