- wxCHECK_RET(gs_autoIdsRefCount[id] != ID_MAXCOUNT, wxT("id count at max"));
- wxCHECK_RET(gs_autoIdsRefCount[id] != ID_FREE, wxT("id should first be reserved"));
+ wxCHECK_RET(gs_autoIdsRefCount[winid] != ID_FREE, wxT("id should first be reserved"));
+
+ if(gs_autoIdsRefCount[winid] == ID_RESERVED)
+ {
+ gs_autoIdsRefCount[winid] = ID_STARTCOUNT;
+ }
+ else if (gs_autoIdsRefCount[winid] >= ID_COUNTTOOLARGE-1)
+ {
+ if (gs_autoIdsRefCount[winid] == ID_COUNTTOOLARGE-1)
+ {
+ // we need to allocate a cell, and maybe the hash map itself
+ if (!gs_autoIdsLargeRefCount)
+ gs_autoIdsLargeRefCount = new wxLongToLongHashMap;
+ (*gs_autoIdsLargeRefCount)[winid] = ID_COUNTTOOLARGE-1;