[Xfce4-commits] [apps/xfdashboard] 07/31: Check for NULL pointer in _xfdashboard_window_content_get_window_frame_xid() because gdk_x11_window_foreign_new_for_display() could return NULL for destroyed windows.

noreply at xfce.org noreply at xfce.org
Thu Jun 11 19:57:02 CEST 2015


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to annotated tag 0.4.1
in repository apps/xfdashboard.

commit 858df6b86b41bfe16f96c465833104113acb1acc
Author: Stephan Haller <nomad at froevel.de>
Date:   Mon Apr 27 06:43:08 2015 +0200

    Check for NULL pointer in _xfdashboard_window_content_get_window_frame_xid() because gdk_x11_window_foreign_new_for_display() could return NULL for destroyed windows.
    
    Hopefully fixes issue GH #83
---
 xfdashboard/window-content.c |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/xfdashboard/window-content.c b/xfdashboard/window-content.c
index aee66dc..2de7232 100644
--- a/xfdashboard/window-content.c
+++ b/xfdashboard/window-content.c
@@ -778,19 +778,27 @@ static Window _xfdashboard_window_content_get_window_frame_xid(Display *inDispla
 	 */
 	gdkDisplay=gdk_display_get_default();
 	gdkWindow=gdk_x11_window_foreign_new_for_display(gdkDisplay, xWindowID);
-	if(gdk_window_get_decorations(gdkWindow, &gdkWindowDecoration) &&
-		gdkWindowDecoration==0)
+	if(gdkWindow)
 	{
-		g_debug("Window '%s' has CSD enabled and no decorations so skip finding window frame.",
-				xfdashboard_window_tracker_window_get_title(inWindow));
+		if(gdk_window_get_decorations(gdkWindow, &gdkWindowDecoration) &&
+			gdkWindowDecoration==0)
+		{
+			g_debug("Window '%s' has CSD enabled and no decorations so skip finding window frame.",
+					xfdashboard_window_tracker_window_get_title(inWindow));
 
-		/* Release allocated resources */
-		g_object_unref(gdkWindow);
+			/* Release allocated resources */
+			g_object_unref(gdkWindow);
 
-		/* Skip finding window frame but return "not-found" result */
-		return(0);
+			/* Skip finding window frame but return "not-found" result */
+			return(0);
+		}
+		g_object_unref(gdkWindow);
 	}
-	g_object_unref(gdkWindow);
+		else
+		{
+			g_debug("Could not get window decoration fro window '%s'",
+						xfdashboard_window_tracker_window_get_title(inWindow));
+		}
 
 	/* Iterate through X window tree list upwards until root window reached.
 	 * The last X window before root window is the one we are looking for.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list