summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eduardo.lima@intel.com>2012-11-23 17:49:39 +0000
committerEduardo de Barros Lima <eblima@gmail.com>2012-11-23 17:49:39 +0000
commit5e69c24b6e292eeac3a1a3a1d5a01e4178adc9c7 (patch)
tree0af6dbcd72ef64c12fe2735f08b5a0f8e8c820d8 /src
parent267f9e21068595e44aa6f298046b51b12049e03a (diff)
Don't leak struct wl_registry
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com> SVN revision: 79565
Diffstat (limited to 'src')
-rw-r--r--src/bin/engine_wayland_egl.c13
-rw-r--r--src/bin/engine_wayland_shm.c11
2 files changed, 14 insertions, 10 deletions
diff --git a/src/bin/engine_wayland_egl.c b/src/bin/engine_wayland_egl.c
index cde38ca..3b5cc67 100644
--- a/src/bin/engine_wayland_egl.c
+++ b/src/bin/engine_wayland_egl.c
@@ -8,10 +8,13 @@
8#include <wayland-client.h> 8#include <wayland-client.h>
9#include <wayland-egl.h> 9#include <wayland-egl.h>
10 10
11/* Global struct */ 11/*
12 * Global struct
13 */
12struct _engine_wayland_egl_display 14struct _engine_wayland_egl_display
13{ 15{
14 struct wl_display *display; 16 struct wl_display *display;
17 struct wl_registry *registry;
15 struct wl_compositor *compositor; 18 struct wl_compositor *compositor;
16 struct wl_surface *surface; 19 struct wl_surface *surface;
17 struct wl_shell *shell; 20 struct wl_shell *shell;
@@ -21,7 +24,7 @@ struct _engine_wayland_egl_display
21static struct _engine_wayland_egl_display wl; 24static struct _engine_wayland_egl_display wl;
22 25
23/* 26/*
24 * Function prototypes 27 * Function Prototypes
25 */ 28 */
26/* Registry handler */ 29/* Registry handler */
27static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__); 30static void _registry_handle_global(void *data, struct wl_registry *registry, unsigned int id, const char *interface, unsigned int version __UNUSED__);
@@ -37,7 +40,6 @@ static const struct wl_registry_listener _registry_listener =
37Eina_Bool 40Eina_Bool
38engine_wayland_egl_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__) 41engine_wayland_egl_args(const char *engine __UNUSED__, int width __UNUSED__, int height __UNUSED__)
39{ 42{
40 struct wl_registry *registry;
41 Evas_Engine_Info_Wayland_Egl *einfo; 43 Evas_Engine_Info_Wayland_Egl *einfo;
42 44
43 evas_output_method_set(evas, evas_render_method_lookup("wayland_egl")); 45 evas_output_method_set(evas, evas_render_method_lookup("wayland_egl"));
@@ -49,8 +51,8 @@ engine_wayland_egl_args(const char *engine __UNUSED__, int width __UNUSED__, int
49 } 51 }
50 52
51 wl.display = wl_display_connect(NULL); 53 wl.display = wl_display_connect(NULL);
52 registry = wl_display_get_registry(wl.display); 54 wl.registry = wl_display_get_registry(wl.display);
53 wl_registry_add_listener(registry, &_registry_listener, NULL); 55 wl_registry_add_listener(wl.registry, &_registry_listener, NULL);
54 wl_display_roundtrip(wl.display); 56 wl_display_roundtrip(wl.display);
55 57
56 assert(wl.compositor != NULL); 58 assert(wl.compositor != NULL);
@@ -83,6 +85,7 @@ engine_wayland_egl_shutdown(void)
83 wl_surface_destroy(wl.surface); 85 wl_surface_destroy(wl.surface);
84 wl_shell_destroy(wl.shell); 86 wl_shell_destroy(wl.shell);
85 wl_compositor_destroy(wl.compositor); 87 wl_compositor_destroy(wl.compositor);
88 wl_registry_destroy(wl.registry);
86 wl_display_flush(wl.display); 89 wl_display_flush(wl.display);
87 wl_display_disconnect(wl.display); 90 wl_display_disconnect(wl.display);
88} 91}
diff --git a/src/bin/engine_wayland_shm.c b/src/bin/engine_wayland_shm.c
index b8d9bce..1f1d468 100644
--- a/src/bin/engine_wayland_shm.c
+++ b/src/bin/engine_wayland_shm.c
@@ -15,6 +15,7 @@
15struct _engine_wayland_shm_display 15struct _engine_wayland_shm_display
16{ 16{
17 struct wl_display *display; 17 struct wl_display *display;
18 struct wl_registry *registry;
18 struct wl_compositor *compositor; 19 struct wl_compositor *compositor;
19 struct wl_surface *surface; 20 struct wl_surface *surface;
20 struct wl_callback *frame_callback; 21 struct wl_callback *frame_callback;
@@ -56,7 +57,6 @@ static const struct wl_callback_listener _surface_frame_listener =
56Eina_Bool 57Eina_Bool
57engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height) 58engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
58{ 59{
59 struct wl_registry *registry;
60 Evas_Engine_Info_Wayland_Shm *einfo; 60 Evas_Engine_Info_Wayland_Shm *einfo;
61 61
62 evas_output_method_set(evas, evas_render_method_lookup("wayland_shm")); 62 evas_output_method_set(evas, evas_render_method_lookup("wayland_shm"));
@@ -68,8 +68,8 @@ engine_wayland_shm_args(const char *engine __UNUSED__, int width, int height)
68 } 68 }
69 69
70 wl.display = wl_display_connect(NULL); 70 wl.display = wl_display_connect(NULL);
71 registry = wl_display_get_registry(wl.display); 71 wl.registry = wl_display_get_registry(wl.display);
72 wl_registry_add_listener(registry, &_registry_listener, NULL); 72 wl_registry_add_listener(wl.registry, &_registry_listener, NULL);
73 wl_display_roundtrip(wl.display); 73 wl_display_roundtrip(wl.display);
74 74
75 assert(wl.compositor != NULL); 75 assert(wl.compositor != NULL);
@@ -120,6 +120,7 @@ engine_wayland_shm_shutdown(void)
120 wl_shm_destroy(wl.shm); 120 wl_shm_destroy(wl.shm);
121 wl_shell_destroy(wl.shell); 121 wl_shell_destroy(wl.shell);
122 wl_compositor_destroy(wl.compositor); 122 wl_compositor_destroy(wl.compositor);
123 wl_registry_destroy(wl.registry);
123 wl_display_flush(wl.display); 124 wl_display_flush(wl.display);
124 wl_display_disconnect(wl.display); 125 wl_display_disconnect(wl.display);
125} 126}
@@ -134,10 +135,10 @@ _registry_handle_global(void *data __UNUSED__, struct wl_registry *registry, uns
134 wl.compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1); 135 wl.compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
135 else if (!strcmp(interface, "wl_shell")) 136 else if (!strcmp(interface, "wl_shell"))
136 wl.shell = wl_registry_bind(registry, id, &wl_shell_interface, 1); 137 wl.shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
137 else if (!strcmp(interface, "wl_shm"))
138 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
139 else if (!strcmp(interface, "wl_seat")) 138 else if (!strcmp(interface, "wl_seat"))
140 engine_wayland_register_seat(registry, id); 139 engine_wayland_register_seat(registry, id);
140 else if (!strcmp(interface, "wl_shm"))
141 wl.shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
141} 142}
142 143
143static void 144static void