From f80061e18442c16eb0663ef9d996db0b1d40cd9f Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 15 Feb 2018 11:06:03 -0600 Subject: [PATCH] ecore_wl2: Take a library reference on surface create Since surface handling is now done via modules, we need to ensure the library can't be shutdown while a surface exists. Otherwise, we get a segfault trying to call a function we've unmapped. Fixes a bug on shutdown for some wayland clients using software rendering. --- src/lib/ecore_wl2/ecore_wl2_surface.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/ecore_wl2/ecore_wl2_surface.c b/src/lib/ecore_wl2/ecore_wl2_surface.c index a702f995a6..9e7512d090 100644 --- a/src/lib/ecore_wl2/ecore_wl2_surface.c +++ b/src/lib/ecore_wl2/ecore_wl2_surface.c @@ -20,6 +20,10 @@ ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface) surface->wl2_win = NULL; free(surface); + /* We took a reference to ecore_wl2 in surface create to prevent + * modules unloading with surfaces in flight. Release that now. + */ + ecore_wl2_shutdown(); } EAPI void @@ -107,6 +111,11 @@ ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha) ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_OFFSCREEN, _ecore_wl2_surface_cb_offscreen, out); + /* Since we have loadable modules, we need to make sure this + * surface keeps ecore_wl2 from de-initting and dlclose()ing + * things until after it's destroyed + */ + ecore_wl2_init(); return out; } }