diff options
author | Pekka Paalanen <pekka.paalanen@collabora.com> | 2019-11-06 12:59:32 +0200 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2019-11-21 16:32:55 +0000 |
commit | 6ffbba3ac13bc16d247ea50ef09cb149d892e125 (patch) | |
tree | f92bdd36e87929a9cc30b0675cfc84b6775ba099 /include/libweston/libweston.h | |
parent | 5caef6d355f87af2e7f20372dc8c328faba53148 (diff) | |
download | weston-6ffbba3ac13bc16d247ea50ef09cb149d892e125.tar.gz weston-6ffbba3ac13bc16d247ea50ef09cb149d892e125.tar.bz2 weston-6ffbba3ac13bc16d247ea50ef09cb149d892e125.zip |
Use weston_compositor_add_destroy_listener_once() in plugins
This introduces a new convention of checking through the compositor destroy
listener if the plugin is already initialized. If the plugin is already
initialized, then the plugin entry function succeeds as a no-op. This makes it
safe to load the same plugin multiple times in a running compositor.
Currently module loading functions return failure if a plugin is already
loaded, but that will change in the future. Therefore we need this other method
of ensuring we do not double-initialize a plugin which would lead to list
corruptions the very least.
All plugins are converted to use the new helper, except:
- those that do not have a destroy listener already, and
- hmi-controller which does the same open-coded as the common code pattern
did not fit there.
Plugins should always have a compositor destroy listener registered since they
very least allocate a struct to hold their data. Hence omissions are
highlighted in code.
Backends do not need this because weston_compositor_load_backend() already
protects against double-init. GL-renderer does not export a standard module
init function so cannot be initialized the usual way and therefore is not
vulnerable to double-init.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Diffstat (limited to 'include/libweston/libweston.h')
-rw-r--r-- | include/libweston/libweston.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index e914d6a3..6b5cc4bf 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -1773,6 +1773,11 @@ struct weston_compositor * weston_compositor_create(struct wl_display *display, struct weston_log_context *log_ctx, void *user_data); +bool +weston_compositor_add_destroy_listener_once(struct weston_compositor *compositor, + struct wl_listener *listener, + wl_notify_func_t destroy_handler); + enum weston_compositor_backend { WESTON_BACKEND_DRM, WESTON_BACKEND_FBDEV, |