fix random crashes upon !reload

A struct plugin_hub_internals was falsely casted to struct
plugin_callback_data. This caused the contained commands list pointer to point to
a struct hub_info and commands->size took the value of a pointer to a struct
net_connection. Since size is increased/decreased every time an item is
added to/removed from the list, this resulted in some funny crashes.

This fix is a little dirty as it exports some internals.
This commit is contained in:
Tilka
2012-04-21 09:22:06 +02:00
parent 832277f653
commit c5036a3ff8
4 changed files with 21 additions and 25 deletions

View File

@@ -32,7 +32,12 @@ struct linked_list* list_create()
void list_destroy(struct linked_list* list)
{
if (list)
{
uhub_assert(list->size == 0);
uhub_assert(list->first == NULL);
uhub_assert(list->last == NULL);
hub_free(list);
}
}
@@ -102,10 +107,11 @@ void list_remove(struct linked_list* list, void* data_ptr)
hub_free(node);
list->size--;
break;
return;
}
node = node->next;
}
uhub_assert(false);
}