| 1388 | } |
| 1389 | |
| 1390 | void CPluginManager::TryRefreshDependencies(CPlugin *pPlugin) |
| 1391 | { |
| 1392 | assert(pPlugin->GetBaseContext() != NULL); |
| 1393 | |
| 1394 | g_ShareSys.BindNativesToPlugin(pPlugin, false); |
| 1395 | |
| 1396 | bool all_found = pPlugin->ForEachRequiredLib([this, pPlugin] (const char *lib) -> bool { |
| 1397 | CPlugin *found = nullptr; |
| 1398 | for (PluginIter iter(m_plugins); !iter.done(); iter.next()) { |
| 1399 | CPlugin *search = (*iter); |
| 1400 | if (search->HasLibrary(lib)) { |
| 1401 | found = search; |
| 1402 | break; |
| 1403 | } |
| 1404 | } |
| 1405 | if (!found) { |
| 1406 | pPlugin->EvictWithError(Plugin_Error, "Library not found: %s", lib); |
| 1407 | return false; |
| 1408 | } |
| 1409 | found->AddDependent(pPlugin); |
| 1410 | return true; |
| 1411 | }); |
| 1412 | if (!all_found) |
| 1413 | return; |
| 1414 | |
| 1415 | /* Find any unbound natives |
| 1416 | * Right now, these are not allowed |
| 1417 | */ |
| 1418 | uint32_t num = pPlugin->runtime()->GetNativesNum(); |
| 1419 | for (unsigned int i=0; i<num; i++) |
| 1420 | { |
| 1421 | const sp_native_t *native = pPlugin->runtime()->GetNative(i); |
| 1422 | if (!native) |
| 1423 | break; |
| 1424 | if (native->status == SP_NATIVE_UNBOUND && |
| 1425 | native->name[0] != '@' && |
| 1426 | !(native->flags & SP_NTVFLAG_OPTIONAL)) |
| 1427 | { |
| 1428 | pPlugin->EvictWithError(Plugin_Error, "Native not found: %s", native->name); |
| 1429 | return; |
| 1430 | } |
| 1431 | } |
| 1432 | |
| 1433 | if (pPlugin->GetStatus() == Plugin_Error) |
| 1434 | { |
| 1435 | /* If we got here, all natives are okay again! */ |
| 1436 | if (pPlugin->GetRuntime()->IsPaused()) |
| 1437 | { |
| 1438 | pPlugin->SetPauseState(false); |
| 1439 | } |
| 1440 | } |
| 1441 | } |
| 1442 | |
| 1443 | bool CPluginManager::UnloadPlugin(IPlugin *plugin) |
| 1444 | { |
nothing calls this directly
no test coverage detected