ecore_wl2: Take a library reference on surface create
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 15 Feb 2018 17:06:03 +0000 (11:06 -0600)
committerWonki Kim <wonki_.kim@samsung.com>
Thu, 5 Apr 2018 18:05:30 +0000 (03:05 +0900)
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

index ee23662..3aad5f6 100644 (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
@@ -113,6 +117,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;
           }
      }