[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 330/473: Fix crash when menu items are changed.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:58:20 CET 2015


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

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit bab5c00bda759f39bd4bbf64479dbfd2aa4a75e6
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Jan 2 06:25:51 2014 -0500

    Fix crash when menu items are changed.
---
 panel-plugin/applications-page.cpp |    6 +++---
 panel-plugin/slot.h                |   38 ------------------------------------
 2 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index f25ab7e..c3712a9 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -227,7 +227,7 @@ void ApplicationsPage::load_contents()
 	}
 
 	// Populate map of menu data
-	g_signal_connect_slot(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
+	g_signal_connect_slot<GarconMenu*>(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
 	load_menu(m_garcon_menu, NULL);
 
 	// Sort items and categories
@@ -333,7 +333,7 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
 	}
 
 	// Listen for menu changes
-	g_signal_connect_slot<GObject*,GObject*>(menu, "directory-changed", &ApplicationsPage::invalidate_applications, this);
+	g_signal_connect_slot<GarconMenu*,GarconMenuDirectory*,GarconMenuDirectory*>(menu, "directory-changed", &ApplicationsPage::invalidate_applications, this);
 }
 
 //-----------------------------------------------------------------------------
@@ -361,7 +361,7 @@ void ApplicationsPage::load_menu_item(GarconMenuItem* menu_item, Category* categ
 	}
 
 	// Listen for menu changes
-	g_signal_connect_slot(menu_item, "changed", &ApplicationsPage::invalidate_applications, this);
+	g_signal_connect_slot<GarconMenuItem*>(menu_item, "changed", &ApplicationsPage::invalidate_applications, this);
 }
 
 //-----------------------------------------------------------------------------
diff --git a/panel-plugin/slot.h b/panel-plugin/slot.h
index f678c18..47576f4 100644
--- a/panel-plugin/slot.h
+++ b/panel-plugin/slot.h
@@ -22,44 +22,6 @@
 
 namespace WhiskerMenu
 {
-
-// Member function without parameters
-template<typename T, typename R>
-gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(), T* obj, bool after = false)
-{
-	class Slot
-	{
-		T* m_instance;
-		R (T::*m_member)();
-
-	public:
-		Slot(T* instance, R (T::*member)()) :
-			m_instance(instance),
-			m_member(member)
-		{
-		}
-
-		static R invoke(gpointer user_data)
-		{
-			Slot* slot = reinterpret_cast<Slot*>(user_data);
-			return (slot->m_instance->*slot->m_member)();
-		}
-
-		static void destroy(gpointer data, GClosure*)
-		{
-			delete reinterpret_cast<Slot*>(data);
-		}
-	};
-	R (*invoke_slot)(gpointer) = &Slot::invoke;
-	void (*destroy_slot)(gpointer, GClosure*) = &Slot::destroy;
-
-	return g_signal_connect_data(instance, detailed_signal,
-			reinterpret_cast<GCallback>(invoke_slot),
-			new Slot(obj, member),
-			destroy_slot,
-			after ? G_CONNECT_AFTER : GConnectFlags(0));
-}
-
 // Member function with 1 parameter
 template<typename T, typename R, typename A1>
 gulong g_signal_connect_slot(gpointer instance, const gchar* detailed_signal, R(T::*member)(A1), T* obj, bool after = false)

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


More information about the Xfce4-commits mailing list