diff --git a/runtime/src/main/java/com4j/EventProxy.java b/runtime/src/main/java/com4j/EventProxy.java old mode 100644 new mode 100755 index 9328cc6..a4cb08e --- a/runtime/src/main/java/com4j/EventProxy.java +++ b/runtime/src/main/java/com4j/EventProxy.java @@ -25,6 +25,7 @@ final class EventProxy implements EventCookie { private final EventInterfaceDescriptor descriptor; private final T javaObject; + private final ComThread thread; /** * Pointer to the native proxy. @@ -35,9 +36,10 @@ final class EventProxy implements EventCookie { * Creates a new event proxy that implements the event interface {@code intf} * and delivers events to {@code javaObject}. */ - EventProxy(Class intf, T javaObject) { + EventProxy(Class intf, T javaObject, ComThread thread) { this.descriptor = getDescriptor(intf); this.javaObject = javaObject; + this.thread = thread; } /** @@ -50,7 +52,7 @@ public Void call() { Native.unadvise(nativeProxy); return null; } - }.execute(); + }.execute(thread); nativeProxy = 0; } } diff --git a/runtime/src/main/java/com4j/Wrapper.java b/runtime/src/main/java/com4j/Wrapper.java old mode 100644 new mode 100755 index 5b0cd20..fff4b01 --- a/runtime/src/main/java/com4j/Wrapper.java +++ b/runtime/src/main/java/com4j/Wrapper.java @@ -275,7 +275,7 @@ public EventProxy call() { throw new ComException("This object doesn't have event source",-1); GUID iid = COM4J.getIID(eventInterface); Com4jObject cp = cpc.FindConnectionPoint(iid); - EventProxy proxy = new EventProxy(eventInterface, object); + EventProxy proxy = new EventProxy(eventInterface, object, thread); proxy.nativeProxy = Native.advise(cp.getPointer(), proxy,iid.v[0], iid.v[1]); // clean up resources to be nice