Some more asserts to try and help spot multiple-release of llcache handles

svn path=/trunk/netsurf/; revision=10327
This commit is contained in:
Daniel Silverstone 2010-04-09 00:06:36 +00:00
parent dc3ce6372f
commit dfae5c33d2
1 changed files with 16 additions and 4 deletions

View File

@ -475,6 +475,9 @@ nserror llcache_object_user_destroy(llcache_object_user *user)
LOG(("Destroyed user %p", user));
#endif
assert(user->next == NULL);
assert(user->prev == NULL);
free(user);
return NSERROR_OK;
@ -996,6 +999,9 @@ nserror llcache_object_destroy(llcache_object *object)
nserror llcache_object_add_user(llcache_object *object,
llcache_object_user *user)
{
assert(user->next == NULL);
assert(user->prev == NULL);
user->handle.object = object;
user->prev = NULL;
@ -1022,7 +1028,9 @@ nserror llcache_object_add_user(llcache_object *object,
nserror llcache_object_remove_user(llcache_object *object,
llcache_object_user *user)
{
assert(object->users);
assert(object->users != NULL);
assert(user->handle.object = object);
assert((user->next != NULL) || (user->prev != NULL) || (object->users == user));
if (user == object->users)
object->users = user->next;
@ -1032,6 +1040,10 @@ nserror llcache_object_remove_user(llcache_object *object,
if (user->next != NULL)
user->next->prev = user->prev;
#ifndef NDEBUG
user->next = user->prev = NULL;
#endif
#ifdef LLCACHE_TRACE
LOG(("Removing user %p from %p", user, object));
#endif