Clear the command vector during plugin load and unload to avoid confusion.

develop
Alexander Gavrilov 2012-03-28 18:47:03 +04:00
parent b7ff7681ac
commit e4e643f9d2
1 changed files with 2 additions and 0 deletions

@ -212,6 +212,7 @@ bool Plugin::load(color_ostream &con)
plugin_rpcconnect = (RPCService* (*)(color_ostream &)) LookupPlugin(plug, "plugin_rpcconnect"); plugin_rpcconnect = (RPCService* (*)(color_ostream &)) LookupPlugin(plug, "plugin_rpcconnect");
this->name = *plug_name; this->name = *plug_name;
plugin_lib = plug; plugin_lib = plug;
commands.clear();
if(plugin_init(con,commands) == CR_OK) if(plugin_init(con,commands) == CR_OK)
{ {
state = PS_LOADED; state = PS_LOADED;
@ -242,6 +243,7 @@ bool Plugin::unload(color_ostream &con)
access->wait(); access->wait();
// cleanup... // cleanup...
parent->unregisterCommands(this); parent->unregisterCommands(this);
commands.clear();
if(cr == CR_OK) if(cr == CR_OK)
{ {
ClosePlugin(plugin_lib); ClosePlugin(plugin_lib);