EventHandler problems

Shabubu

10-11-2005 12:05:14

Howdy -

I'm trying to set some event handlers, but the stub Maleficus setup regarding eventhandlers (EventHandler.cs/.h) is giving me an odd error.


public SWIGTYPE_p_f___bool mEventFunctionPointer
{
set
{
CeguiBindingsPINVOKE.EventHandler_mEventFunctionPointer_set(swigCPtr, SWIGTYPE_p_f___bool.getCPtr(value));
}
get
{
IntPtr cPtr = CeguiBindingsPINVOKE.EventHandler_mEventFunctionPointer_get(swigCPtr);
SWIGTYPE_p_f___bool ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f___bool(cPtr, false);
return ret;
}
}


public EventHandler(Window window, string eventname) : this(CeguiBindingsPINVOKE.new_EventHandler(Window.getCPtr(window), new CeguiDotNet.String(eventname).HandleRef), true)
{


Where it actually breaks:

EventHandler( CEGUI::Window * window, const CEGUI::String & eventname)
{
mEventArgs = new CEGUI::EventArgs();
mEventFunctionPointer = NULL;
Event::Subscriber sub = Event::Subscriber(&EventHandler::HandleCEGUIEvent, this);
----> window->subscribeEvent( eventname, sub);
// window->subscribeEvent(eventname, this);

}


EventHandler->mEventFunctionPointer is causing a System.AccessViolationException
Exception Information:

Message "Attempted to read or write protected memory.
This is often an indication that other memory is corrupt."
Source "CeguiDotNet"
StackTrace " at CeguiDotNet.CeguiBindingsPINVOKE.EventHandler_mEventFunctionPointer_get(HandleRef jarg1)
at CeguiDotNet.EventHandler.get_mEventFunctionPointer() in G:\\ogreAddons\\ogredotnet\\CeguiNet\\EventHandler.cs:line 59"
TargetSite {IntPtr EventHandler_mEventFunctionPointer_get(System.Runtime.InteropServices.HandleRef)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

This EventHandler stuff makes no sense to me, and I have spent all day at it. Has anyone else had this problem regarding EventHandlers?