Ver código fonte

Fix a refcount bug in the entity dictionary.

legacy
Sam Hocevar sam 14 anos atrás
pai
commit
be70a70eaa
1 arquivos alterados com 10 adições e 1 exclusões
  1. +10
    -1
      src/dict.cpp

+ 10
- 1
src/dict.cpp Ver arquivo

@@ -40,8 +40,10 @@ public:

~DictData()
{
#if !FINAL_RELEASE
if (nentities)
fprintf(stderr, "ERROR: still %i entities in dict\n", nentities);
#endif
free(entities);
}

@@ -103,8 +105,15 @@ int Dict::MakeSlot(char const *name)
void Dict::RemoveSlot(int id)
{
if (Ticker::Unref(data->entities[id]) == 0)
{
data->entities[id] = NULL;
data->nentities--;
if (data->nentities)
data->nentities--;
#if !FINAL_RELEASE
else
fprintf(stderr, "ERROR: removing entity from empty dict\n");
#endif
}
}




Carregando…
Cancelar
Salvar