coolermaster keyboard rescan crash

This commit is contained in:
Tam D 2024-06-27 13:09:52 +00:00 committed by Adam Honse
parent d1a638e6f0
commit 5df9dcdf9c
4 changed files with 19 additions and 12 deletions

View file

@ -49,13 +49,26 @@ RGBController_CMKeyboardController::RGBController_CMKeyboardController(CMKeyboar
RGBController_CMKeyboardController::~RGBController_CMKeyboardController()
{
for(size_t i = 0; i < m_pUnknownKeyNames.size(); i++)
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(m_pUnknownKeyNames[i])
if(zones[zone_index].matrix_map != NULL)
{
delete(m_pUnknownKeyNames[i]);
if(zones[zone_index].matrix_map->map != NULL)
{
delete zones[zone_index].matrix_map->map;
}
delete zones[zone_index].matrix_map;
}
}
if(m_pController)
{
delete m_pController;
}
}
#define COOLERMASTER_ZONES_MAX 1
@ -88,8 +101,6 @@ void RGBController_CMKeyboardController::SetupZones()
matrix_map_type * new_map = new matrix_map_type;
new_zone.matrix_map = new_map;
new_map->map = new unsigned int[new_map->height * new_map->width];
if(coolermaster->layout_new->base_size != KEYBOARD_SIZE_EMPTY)
{
/*---------------------------------------------------------*\
@ -100,6 +111,7 @@ void RGBController_CMKeyboardController::SetupZones()
new_map->height = new_kb.GetRowCount();
new_map->width = new_kb.GetColumnCount();
new_map->map = new unsigned int[new_map->height * new_map->width];
/*---------------------------------------------------------*\
| Matrix map still uses declared zone rows and columns |