You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When constructing a wrapper from a C pointer to an interface using COM4J.wrap, all subsequent method calls on that object are done on a com4j.ComThread. This isn't the same thread that was used to create the object, and so it will cause problems.
When wrapping the pointer, com4j should marshal the object across to its com4j.ComThread instead of just taking the pointer.
One possible solution would be to use RegisterInterfaceInGlobal/GetInterfaceFromGlobal to pass a handle across the thread boundary and add a call to RevokeInterfaceFromGlobal when releasing the native object.
Is this something that anyone else has come across? Have I missed something, or is using COM4J.wrap not the right thing to be using for this purpose?
I'm happy to make the changes necessary, but is this project still being actively maintained by anyone? Are my changes likely to be merged?
The text was updated successfully, but these errors were encountered:
Objects wrapped in this way can only be called from the same thread they
were created by (and wrapped in).
When using these wrapped objects calls to the COM object are done in the
same thread instead of using a second thread. This has the disadvantage
that these objects can't be passed around and used from anywhere, but
where a COM object has to be called from a specific thread it means they
can be used (mostly only a problem when the Java code is running in the
same process as an in-process COM server).
Fixeskohsuke#68
When constructing a wrapper from a C pointer to an interface using COM4J.wrap, all subsequent method calls on that object are done on a com4j.ComThread. This isn't the same thread that was used to create the object, and so it will cause problems.
When wrapping the pointer, com4j should marshal the object across to its com4j.ComThread instead of just taking the pointer.
One possible solution would be to use RegisterInterfaceInGlobal/GetInterfaceFromGlobal to pass a handle across the thread boundary and add a call to RevokeInterfaceFromGlobal when releasing the native object.
Is this something that anyone else has come across? Have I missed something, or is using COM4J.wrap not the right thing to be using for this purpose?
I'm happy to make the changes necessary, but is this project still being actively maintained by anyone? Are my changes likely to be merged?
The text was updated successfully, but these errors were encountered: