Fix bug #180 - Crash after signal SIGHUP.
This commit is contained in:
@@ -127,9 +127,10 @@ static int cbfunc_command_add(struct plugin_handle* plugin, struct plugin_comman
|
||||
command->origin = cmdh->origin;
|
||||
command->handler = plugin_command_dispatch;
|
||||
|
||||
cmdh->internal_handle = data;
|
||||
cmdh->internal_handle = command;
|
||||
list_append(data->commands, cmdh);
|
||||
command_add(plugin_get_hub(plugin)->commands, command, (void*) plugin);
|
||||
printf("*** Add plugin command: %s (%p, %p)\n", command->prefix, command, cmdh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -138,11 +139,11 @@ static int cbfunc_command_del(struct plugin_handle* plugin, struct plugin_comman
|
||||
struct plugin_callback_data* data = get_callback_data(plugin);
|
||||
struct command_handle* command = (struct command_handle*) cmdh->internal_handle;
|
||||
|
||||
printf("*** Del plugin command: %s (%p, %p)\n", command->prefix, command, cmdh);
|
||||
list_remove(data->commands, cmdh);
|
||||
cmdh->internal_handle = 0;
|
||||
|
||||
command_del(plugin_get_hub(plugin)->commands, (void*) command);
|
||||
|
||||
command_del(plugin_get_hub(plugin)->commands, command);
|
||||
hub_free(command);
|
||||
cmdh->internal_handle = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user