All pastes #11353 Raw Edit

Miscellany

public text v1 · immutable
#11353 ·published 2005-05-09 21:00 UTC
rendered paste body

Hashtable callbacks = new Hashtable ();

public static IntPtr EventHandlerAdd(int type, func_ecore_event_handler_add func, IntPtr data)
{
	IntPtr key = ecore_event_handler_add(type, func, data);

	// Keep a reference so that `func' is not garbage collected. 
	callbacks [key] = func;

	return val;
}

public static void EventHandlerRemove(IntPtr key)
{
	if (!callbacks.Contains [key])
		throw new Exception ("key is invalid");

	ecore_event_handler_remove (key);
	callbacks.Remove (key);
}