[PATCH] client: don't call drag_offer_handler if it not hooked

wucan canbaby at 21cn.com
Fri Nov 12 17:18:04 PST 2010


When play with dnd and terminal, if you drag any item in dnd to
terminal,terminal segvment fault. It's because terminal not setup 
drag_offer_handler, but when a item draged on it's window, 
display_handle_global() trigger the handler.
---
  clients/window.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 9dfd355..5f69561 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1329,7 +1329,9 @@ display_handle_global(struct wl_display *display, 
uint32_t id,
  		d->shm = wl_shm_create(display, id);
  	} else if (strcmp(interface, "drag_offer") == 0) {
  		offer = wl_drag_offer_create(display, id);
-		d->drag_offer_handler(offer, d);
+		if (d->drag_offer_handler) {
+			d->drag_offer_handler(offer, d);
+		}
  	}
  }

-- 
1.6.4.GIT
-- 
wucan


More information about the wayland-devel mailing list