Merge "Ensure loaded plugins are not copied."
diff --git a/runtime/plugin.cc b/runtime/plugin.cc
index 7d86f1d..6f1c517 100644
--- a/runtime/plugin.cc
+++ b/runtime/plugin.cc
@@ -28,10 +28,7 @@
const char* PLUGIN_DEINITIALIZATION_FUNCTION_NAME = "ArtPlugin_Deinitialize";
Plugin::Plugin(const Plugin& other) : library_(other.library_), dlopen_handle_(nullptr) {
- if (other.IsLoaded()) {
- std::string err;
- Load(&err);
- }
+ CHECK(!other.IsLoaded()) << "Should not copy loaded plugins.";
}
bool Plugin::Load(/*out*/std::string* error_msg) {
diff --git a/runtime/plugin.h b/runtime/plugin.h
index 909c710..4885b2e 100644
--- a/runtime/plugin.h
+++ b/runtime/plugin.h
@@ -60,7 +60,7 @@
Plugin(const Plugin& other);
// Create move constructor for putting this in a list
- Plugin(Plugin&& other)
+ Plugin(Plugin&& other) noexcept
: library_(other.library_),
dlopen_handle_(other.dlopen_handle_) {
other.dlopen_handle_ = nullptr;