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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user