7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Fix assert in hotkey list when double-clicking on a section header.

Assert message:

Assertion failed at C:\jenkins\workspace\build-windows-kicad-msvc-8.0-stable\.build\kicad\common\widgets\widget_hotkey_list.cpp:309 in WIDGET_HOTKEY_LIST::getExpectedHkClientData: hkdata != nullptr - No hotkey data found for list item

Fixes KICAD-7NV
This commit is contained in:
Alex Shvartzkop 2024-12-23 20:50:23 +03:00
parent 3800bae281
commit 9b40e6b2e3
2 changed files with 2 additions and 20 deletions
common/widgets
include/widgets

View File

@ -302,18 +302,6 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getHKClientData( wxTreeListItem a
}
WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::getExpectedHkClientData( wxTreeListItem aItem )
{
const auto hkdata = getHKClientData( aItem );
// This probably means a hotkey-only action is being attempted on
// a row that is not a hotkey (like a section heading)
wxASSERT_MSG( hkdata != nullptr, "No hotkey data found for list item" );
return hkdata;
}
void WIDGET_HOTKEY_LIST::updateFromClientData()
{
for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) )
@ -371,7 +359,7 @@ void WIDGET_HOTKEY_LIST::changeHotkey( HOTKEY& aHotkey, long aKey, bool alternat
void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem );
if( !hkdata )
return;
@ -405,7 +393,7 @@ void WIDGET_HOTKEY_LIST::editItem( wxTreeListItem aItem, int aEditId )
void WIDGET_HOTKEY_LIST::resetItem( wxTreeListItem aItem, int aResetId )
{
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getExpectedHkClientData( aItem );
WIDGET_HOTKEY_CLIENT_DATA* hkdata = getHKClientData( aItem );
if( !hkdata )
return;

View File

@ -142,12 +142,6 @@ private:
*/
WIDGET_HOTKEY_CLIENT_DATA* getHKClientData( wxTreeListItem aItem );
/**
* Get the WIDGET_HOTKEY_CLIENT_DATA form an item and assert if it isn't found. This is for
* use when the data not being present indicates an error.
*/
WIDGET_HOTKEY_CLIENT_DATA* getExpectedHkClientData( wxTreeListItem aItem );
/**
* Method updateFromClientData
* Refresh the visible text on the widget from the rows' client data objects.