Fix bug #180 - Crash after signal SIGHUP.

This commit is contained in:
Jan Vidar Krey
2012-01-19 02:58:20 +01:00
parent a9b5c6db38
commit 8607b40278
3 changed files with 32 additions and 7 deletions

View File

@@ -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;
}