ecore-wl2: Ensure display cleanup after roundtrips

Commit ee52a28d04 added a roundtrip to
ensure and pending wl events were handled before we disconnected the
display. While this ensures some things like session recovery destroy
work again, it lead to an issue where the _ecore_wl2_display_cleanup
function was called BEFORE we processed pending events. This (in turn)
causes crashes due to processing of pending events that relied on
things like Ecore_Wl2_Input existing. As the display cleanup function
clears inputs & outputs, we need to defer calling that until the
display_roundtrip has dispatched and handled pending events.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-03-01 08:32:18 -05:00
parent 7359f0be6e
commit c6b59be1da
1 changed files with 8 additions and 4 deletions

View File

@ -564,8 +564,6 @@ _ecore_wl2_display_cleanup(Ecore_Wl2_Display *ewd)
Ecore_Wl2_Input *input;
Eina_Inlist *tmp;
if (--ewd->refs) return;
if (ewd->xkb_context) xkb_context_unref(ewd->xkb_context);
/* free each input */
@ -809,7 +807,7 @@ ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
{
EINA_SAFETY_ON_NULL_RETURN(display);
_ecore_wl2_display_cleanup(display);
--display->refs;
if (display->refs == 0)
{
wl_display_roundtrip(display->wl.display);
@ -818,6 +816,8 @@ ecore_wl2_display_disconnect(Ecore_Wl2_Display *display)
/* remove this client display from hash */
eina_hash_del_by_key(_client_displays, display->name);
_ecore_wl2_display_cleanup(display);
free(display->name);
free(display);
}
@ -828,9 +828,13 @@ ecore_wl2_display_destroy(Ecore_Wl2_Display *display)
{
EINA_SAFETY_ON_NULL_RETURN(display);
_ecore_wl2_display_cleanup(display);
--display->refs;
if (display->refs == 0)
{
/* this ensures that things like wl_registry are destroyed
* before we destroy the actual wl_display */
_ecore_wl2_display_cleanup(display);
wl_display_destroy(display->wl.display);
/* remove this client display from hash */