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.
This commit is contained in:
Derek Foreman 2018-02-15 11:06:03 -06:00
parent 6f0d962f67
commit f80061e184
1 changed files with 9 additions and 0 deletions

View File

@ -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;
}
}