| 2068 | } |
| 2069 | |
| 2070 | bool CPluginManager::ReloadPlugin(CPlugin *pl, bool print) |
| 2071 | { |
| 2072 | PluginState state = pl->State(); |
| 2073 | if (state == PluginState::WaitingToUnloadAndReload) |
| 2074 | return false; |
| 2075 | |
| 2076 | std::string filename(pl->GetFilename()); |
| 2077 | PluginType ptype = pl->GetType(); |
| 2078 | |
| 2079 | int id = 1; |
| 2080 | for (PluginIter iter(m_plugins); !iter.done(); iter.next(), id++) { |
| 2081 | if ((*iter) == pl) |
| 2082 | break; |
| 2083 | } |
| 2084 | |
| 2085 | if (!UnloadPlugin(pl)) |
| 2086 | { |
| 2087 | if (pl->State() == PluginState::WaitingToUnload) |
| 2088 | { |
| 2089 | pl->SetWaitingToUnload(true); |
| 2090 | ScheduleTaskForNextFrame([this, id, filename, ptype, print]() -> void { |
| 2091 | ReloadPluginImpl(id, filename.c_str(), ptype, print); |
| 2092 | }); |
| 2093 | } |
| 2094 | return false; |
| 2095 | } |
| 2096 | |
| 2097 | ReloadPluginImpl(id, filename.c_str(), ptype, false); |
| 2098 | return true; |
| 2099 | } |
| 2100 | |
| 2101 | void CPluginManager::ReloadPluginImpl(int id, const char filename[], PluginType ptype, bool print) |
| 2102 | { |
nothing calls this directly
no test coverage detected