fix unload
This commit is contained in:
@@ -71,10 +71,10 @@ void App::load(std::string lib) {
|
||||
}
|
||||
|
||||
modules.push_back(m);
|
||||
m->setSelf(modules.rbegin());
|
||||
m->setSelf(modules.rbegin().base());
|
||||
}
|
||||
|
||||
void App::unload(std::list<Module*>::iterator it) {
|
||||
void App::unload(decltype(Module::self) it) {
|
||||
void* handle = (*it)->getHandle();
|
||||
delete *it;
|
||||
dlclose(handle);
|
||||
|
||||
@@ -24,7 +24,7 @@ class App {
|
||||
|
||||
void load(std::string);
|
||||
|
||||
void unload(std::list<Module*>::iterator);
|
||||
void unload(decltype(Module::self));
|
||||
|
||||
void handleArgs(const int&, char*[]);
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class App;
|
||||
|
||||
class Module {
|
||||
|
||||
friend class App;
|
||||
|
||||
public:
|
||||
typedef Module* create_t(void*, App&);
|
||||
typedef void* destroy_t(Module*);
|
||||
@@ -17,12 +19,12 @@ class Module {
|
||||
std::string getName() const { return name; }
|
||||
void* getHandle() { return handle; }
|
||||
|
||||
void setSelf(std::list<Module*>::reverse_iterator s) { self = s; }
|
||||
void setSelf(std::list<Module*>::iterator s) { self = s; }
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
void* handle;
|
||||
std::list<Module*>::reverse_iterator self;
|
||||
std::list<Module*>::iterator self;
|
||||
|
||||
App& app;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user