[Xfce4-commits] [apps/xfdashboard] 01/01: Emit signal for a stopped application _AFTER_ it was removed from list of running application. Otherwise a request if that application is running will still be answered with yes.

noreply at xfce.org noreply at xfce.org
Mon Jul 6 16:52:48 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 f67eefbedb33d4afc9751b6f00612ac54d1ac9d8
Author: Stephan Haller <nomad at froevel.de>
Date:   Mon Jul 6 16:51:59 2015 +0200

    Emit signal for a stopped application _AFTER_ it was removed from list of running application. Otherwise a request if that application is running will still be answered with yes.
---
 xfdashboard/application-tracker.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/xfdashboard/application-tracker.c b/xfdashboard/application-tracker.c
index 275dda8..d4d1013 100644
--- a/xfdashboard/application-tracker.c
+++ b/xfdashboard/application-tracker.c
@@ -634,6 +634,9 @@ static void _xfdashboard_application_tracker_on_window_opened(XfdashboardApplica
 		priv->runningApps=g_list_prepend(priv->runningApps, item);
 
 		/* Emit signal as this application is known to be running now */
+		g_message("%s: Emitting signal 'state-changed' to running for desktop ID '%s'",
+					__func__,
+					item->desktopID);
 		g_signal_emit(self, XfdashboardApplicationTrackerSignals[SIGNAL_STATE_CHANGED], g_quark_from_string(item->desktopID), item->desktopID, TRUE);
 	}
 		/* ... otherwise add window to existing one */
@@ -687,19 +690,32 @@ static void _xfdashboard_application_tracker_on_window_closed(XfdashboardApplica
 	if(!item->windows ||
 		g_list_length(item->windows)==0)
 	{
+		gchar								*desktopID;
+
 		g_message("%s: Closing window '%s' for desktop ID '%s' closed last window so remove application from list of running ones",
 					__func__,
 					xfdashboard_window_tracker_window_get_title(inWindow),
 					item->desktopID);
 
-		/* Emit signal as this application is not running anymore */
-		g_signal_emit(self, XfdashboardApplicationTrackerSignals[SIGNAL_STATE_CHANGED], g_quark_from_string(item->desktopID), item->desktopID, FALSE);
+		/* Create a copy of desktop ID for signal emission because the
+		 * application tracker item will be removed and freed before.
+		 */
+		desktopID=g_strdup(item->desktopID);
 
-		/* Remove application tracker item from list of running applications */
+		/* Remove application tracker item from list of running applications
+		 * and free it.
+		 */
 		priv->runningApps=g_list_remove(priv->runningApps, item);
+		_xfdashboard_application_tracker_item_free(item);
+
+		/* Emit signal as this application is not running anymore */
+		g_message("%s: Emitting signal 'state-changed' to stopped for desktop ID '%s'",
+					__func__,
+					desktopID);
+		g_signal_emit(self, XfdashboardApplicationTrackerSignals[SIGNAL_STATE_CHANGED], g_quark_from_string(desktopID), desktopID, FALSE);
 
 		/* Release allocated resources */
-		_xfdashboard_application_tracker_item_free(item);
+		g_free(desktopID);
 	}
 }
 

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


More information about the Xfce4-commits mailing list