From 9f4dfe77cbd813403d694998e19fe7c1dccf4a35 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 14 Jun 2024 14:59:14 -0700 Subject: [PATCH] Freeze the adapter to avoid invalid deref GTK tries to get the parent item of selected elements when unselecting. If we don't freeze, we run the risk of crashing if a selected item is removed before being unselected. This causes a wx warning but a) this is suppressed in release and b) warning message is better than crash. See next commit for fix to avoid common case of the error --- common/widgets/lib_tree.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index 80f64eb1eb..25f08c02a5 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -354,7 +354,9 @@ void LIB_TREE::CenterLibId( const LIB_ID& aLibId ) void LIB_TREE::Unselect() { + m_tree_ctrl->Freeze(); m_tree_ctrl->UnselectAll(); + m_tree_ctrl->Thaw(); }