[PATCH weston] Fix a crash when parent surface is NULL.

Dima Ryazanov dima at gmail.com
Mon Jul 23 18:47:40 PDT 2012


It happens to me if I run gedit (using X11), click "Open", then press ESC
to dismiss the dialog box.
---
 src/shell.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index a9e4d4f..9f201ca 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1246,9 +1246,10 @@ set_surface_type(struct shell_surface *shsurf)
 	case SHELL_SURFACE_TOPLEVEL:
 		break;
 	case SHELL_SURFACE_TRANSIENT:
-		weston_surface_set_position(surface,
-				pes->geometry.x + shsurf->transient.x,
-				pes->geometry.y + shsurf->transient.y);
+		if (pes)
+			weston_surface_set_position(surface,
+					pes->geometry.x + shsurf->transient.x,
+					pes->geometry.y + shsurf->transient.y);
 		break;
 
 	case SHELL_SURFACE_MAXIMIZED:
@@ -2585,7 +2586,8 @@ map(struct desktop_shell *shell, struct weston_surface *surface,
 	case SHELL_SURFACE_POPUP:
 	case SHELL_SURFACE_TRANSIENT:
 		parent = shsurf->parent;
-		wl_list_insert(parent->layer_link.prev, &surface->layer_link);
+		if (parent)
+			wl_list_insert(parent->layer_link.prev, &surface->layer_link);
 		break;
 	case SHELL_SURFACE_FULLSCREEN:
 	case SHELL_SURFACE_NONE:
-- 
1.7.9.5



More information about the wayland-devel mailing list