Make double-loading a plugin harmless
The testing harness improvements I have brewing in !287 (merged) will execute the Weston compositor by simply calling wet_main()
instead of fork()
ing and it may do that multiple times in a row to test different compositor setups. All plugins loaded on the first run will remain loaded for the next runs, which means we cannot have the tests work if the plugin loading will fail for plugins being already loaded. But we also need to protect against accidental double-initialization of plugins in the same compositor instance which might happen due to a misconfiguration (command line or weston.ini
).
This MR prevents plugins from being double-initialized but allows them to be already loaded.
The new method relies on compositor destroy listeners but not all plugins actually install one. Issues have been filed for them: #298 (closed), #299 (closed), #300 (closed).