[Xfce4-commits] [apps/xfdashboard] 01/01: 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
Mon Apr 27 06:44:02 CEST 2015


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

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 4ba375518c74e0b8321344a81d17b02849aee04c
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 ec28adf..e17f7d5 100644
--- a/xfdashboard/window-content.c
+++ b/xfdashboard/window-content.c
@@ -776,19 +776,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