devilhorns pushed a commit to branch master.

commit 91301b4d23a351c7134c03a0cbecc8f25fc6decf
Author: Chris Michael <[email protected]>
Date:   Tue Jul 2 09:32:36 2013 +0100

    Don't try to bind desktop_shell inside of shell_bind (separate bind
    for desktop_shell).
    Use wl_resource_set_destructor.
    When shell gets unbound, don't "free" the resource (handled internally
    via wayland).
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/wl_desktop_shell/e_mod_main.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/modules/wl_desktop_shell/e_mod_main.c 
b/src/modules/wl_desktop_shell/e_mod_main.c
index c12ca03..3a53860 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -251,7 +251,6 @@ static void
 _e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned int version 
EINA_UNUSED, unsigned int id)
 {
    E_Wayland_Desktop_Shell *shell = NULL;
-   struct wl_resource *res = NULL;
 
    /* try to cast data to our shell */
    if (!(shell = data)) return;
@@ -259,14 +258,6 @@ _e_wl_shell_cb_bind(struct wl_client *client, void *data, 
unsigned int version E
    /* try to add the shell to the client */
    wl_client_add_object(client, &wl_shell_interface, 
                         &_e_shell_interface, id, shell);
-
-   res = wl_client_new_object(client, &e_desktop_shell_interface, 
-                              &_e_desktop_shell_interface, shell);
-
-   shell->wl.resource = res;
-
-   /* set desktop shell destroy callback */
-   res->destroy = _e_wl_desktop_shell_cb_unbind;
 }
 
 static void 
@@ -467,13 +458,16 @@ _e_wl_desktop_shell_cb_bind(struct wl_client *client, 
void *data, unsigned int v
    shell->wl.resource = res;
 
    /* set desktop shell destroy callback */
-   res->destroy = _e_wl_desktop_shell_cb_unbind;
+   wl_resource_set_destructor(res, _e_wl_desktop_shell_cb_unbind);
 }
 
 static void 
 _e_wl_desktop_shell_cb_unbind(struct wl_resource *resource)
 {
-   free(resource);
+   E_Wayland_Desktop_Shell *shell = NULL;
+
+   shell = wl_resource_get_user_data(resource);
+   shell->wl.resource = NULL;
 }
 
 /* desktop shell interface functions */

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to