libweston: allow double-loading modules

This is necessary for the test harness to be able to execute the compositor
multiple times in the same process. As we never unload opened modules, the
first compositor iteration will leave them all loaded and following compositor
iterations will then have them already loaded.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago committed by Daniel Stone
parent 6ffbba3ac1
commit f696ee9337
  1. 16
      libweston/compositor.c

@ -7618,15 +7618,13 @@ weston_load_module(const char *name, const char *entrypoint)
module = dlopen(path, RTLD_NOW | RTLD_NOLOAD);
if (module) {
weston_log("Module '%s' already loaded\n", path);
dlclose(module);
return NULL;
}
weston_log("Loading module '%s'\n", path);
module = dlopen(path, RTLD_NOW);
if (!module) {
weston_log("Failed to load module: %s\n", dlerror());
return NULL;
} else {
weston_log("Loading module '%s'\n", path);
module = dlopen(path, RTLD_NOW);
if (!module) {
weston_log("Failed to load module: %s\n", dlerror());
return NULL;
}
}
init = dlsym(module, entrypoint);

Loading…
Cancel
Save