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,7 @@ struct uhub_plugin
|
||||
void* handle;
|
||||
plugin_unregister_f unregister;
|
||||
char* filename;
|
||||
void* internals; // Hub internal stuff
|
||||
void* internals; // Hub-internal stuff (struct plugin_hub_internals)
|
||||
};
|
||||
|
||||
struct uhub_plugins
|
||||
@@ -40,7 +40,7 @@ struct uhub_plugins
|
||||
struct linked_list* loaded;
|
||||
};
|
||||
|
||||
// High level plugin loader ode
|
||||
// High level plugin loader code
|
||||
extern struct plugin_handle* plugin_load(const char* filename, const char* config, struct hub_info* hub);
|
||||
extern void plugin_unload(struct plugin_handle* plugin);
|
||||
|
||||
@@ -54,7 +54,14 @@ extern void plugin_close(struct uhub_plugin*);
|
||||
extern void* plugin_lookup_symbol(struct uhub_plugin*, const char* symbol);
|
||||
|
||||
// Used internally only
|
||||
struct plugin_hub_internals
|
||||
{
|
||||
struct hub_info* hub;
|
||||
plugin_unregister_f unregister; /* The unregister function. */
|
||||
struct plugin_callback_data* callback_data; /* callback data that is unique for the plugin */
|
||||
};
|
||||
|
||||
extern struct plugin_hub_internals* get_internals(struct plugin_handle*);
|
||||
extern struct hub_info* plugin_get_hub(struct plugin_handle*);
|
||||
|
||||
#endif /* HAVE_UHUB_PLUGIN_LOADER_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user