[PATCH weston] compositor: reset surface's resource field on resource destruction

2013-09-11 Thread Giulio Camuffo
with the surface ref-count feature a surface may live on after its
resource was destroyed. set it to NULL in that case, so that code
like find_resource_for_surface() in input.c will act accordingly.
---
 src/compositor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 88df279..e4ce428 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1070,6 +1070,9 @@ destroy_surface(struct wl_resource *resource)
 {
struct weston_surface *surface = wl_resource_get_user_data(resource);
 
+   /* the surface may live so make sure nothing thinks
+  it still has a resource */
+   surface-resource = NULL;
weston_surface_destroy(surface);
 }
 
-- 
1.8.4

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor: reset surface's resource field on resource destruction

2013-09-11 Thread Jason Ekstrand
Remember the problem we had a couple months ago with null surfaces being
passed to wl_pointer.leave if the leave was caused by the surface being
destroyed? If you set surface-resource = NULL before destroying it this
bug will come up again.
On Sep 11, 2013 11:28 AM, Giulio Camuffo giuliocamu...@gmail.com wrote:

 with the surface ref-count feature a surface may live on after its
 resource was destroyed. set it to NULL in that case, so that code
 like find_resource_for_surface() in input.c will act accordingly.
 ---
  src/compositor.c | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/src/compositor.c b/src/compositor.c
 index 88df279..e4ce428 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -1070,6 +1070,9 @@ destroy_surface(struct wl_resource *resource)
  {
 struct weston_surface *surface =
 wl_resource_get_user_data(resource);

 +   /* the surface may live so make sure nothing thinks
 +  it still has a resource */
 +   surface-resource = NULL;
 weston_surface_destroy(surface);
  }

 --
 1.8.4

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel