compositor: 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 f696ee9337
commit 3025353e83
  1. 16
      compositor/main.c

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

Loading…
Cancel
Save