mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-08 11:52:02 +08:00
fix a bug: uninitialize the callback functions for the map of system bitmaps; add __mg_map_get_size
This commit is contained in:
@@ -85,6 +85,7 @@ map_entry_t* __mg_map_find (map_t* map, const void* key);
|
||||
int __mg_map_insert (map_t* map, const void* key, const void* val);
|
||||
void* __mg_map_find_or_insert (map_t* map, const void* key, const void* val);
|
||||
int __mg_map_erase (map_t* map, void* key);
|
||||
int __mg_map_get_size (map_t* map);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -101,10 +101,21 @@ map_t* __mg_map_create (copy_key_fn copy_key, free_key_fn free_key,
|
||||
if (!(map = calloc (1, sizeof(map_t))))
|
||||
return NULL;
|
||||
|
||||
map->copy_key = copy_key;
|
||||
map->free_key = free_key;
|
||||
map->copy_val = copy_val;
|
||||
map->free_val = free_val;
|
||||
map->comp_key = comp_key;
|
||||
|
||||
WRLOCK_INIT (map);
|
||||
return map;
|
||||
}
|
||||
|
||||
int __mg_map_get_size (map_t* map)
|
||||
{
|
||||
return map->size;
|
||||
}
|
||||
|
||||
int __mg_map_destroy (map_t* map)
|
||||
{
|
||||
if (map == NULL)
|
||||
|
||||
@@ -487,7 +487,6 @@ void TerminateResManager()
|
||||
|
||||
/* Since 5.0.0, destroy the map for system bitmaps */
|
||||
__mg_map_destroy (__mg_sys_bmp_map);
|
||||
|
||||
}
|
||||
|
||||
const char* __sysres_get_system_res_path()
|
||||
|
||||
@@ -386,6 +386,8 @@ BOOL GUIAPI RegisterSystemBitmap (HDC hdc, const char* rdr_name, const char* id)
|
||||
free (bmp);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_DBG_PRINTF ("Registered system bitmap for key: %s\n", key);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -416,7 +418,7 @@ void GUIAPI UnregisterSystemBitmap (HDC hdc, const char* rdr_name, const char* i
|
||||
}
|
||||
|
||||
if (__mg_map_erase (__mg_sys_bmp_map, key)) {
|
||||
_WRN_PRINTF ("not registered system bitmap: %s.%s\n", rdr_name, id);
|
||||
_WRN_PRINTF ("not registered system bitmap for key: %s\n", key);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user