-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some of the failing COM unittests #578
Merged
Merged
Commits on Feb 21, 2016
-
Make REFIID a real pointer type to fix native callbacks
After the change introduced in d7f91f1 native callbacks for the COM handling error out (see below). Analysing the stack trace this happens after the java function was called. There structures are syncing back from java to native. I asume the calling programm passes in a readonly version of the IID and so the write fails. This code path was not hit before the above mentioned changeset, because there is a typeguard, that prevents syncing for ByValue calls (which were removed be the changeset). In addition to this, a fix ComEventCallbacks_Test to not depend on an installed office was commited. Now the Internet Explorer is used, as it can be expected to be present. Tests from ConnectionPointerContainer_Test duplicated a good part of ComEventCallbacks_Test so the cases were integrated into ComEventCallbacks_Test. The exception leading to this fix (CallbackReference.java:513 synchronised structed passed by reference after the java invocation): JNA: Callback com.sun.jna.platform.win32.COM.DispatchListener$1@233c0b17 threw the following exception: java.lang.Error: Invalid memory access at com.sun.jna.Native.setInt(Native Method) at com.sun.jna.Pointer.setInt(Pointer.java:1124) at com.sun.jna.Pointer.setValue(Pointer.java:925) at com.sun.jna.Structure.writeField(Structure.java:842) at com.sun.jna.Structure.write(Structure.java:754) at com.sun.jna.Structure.autoWrite(Structure.java:2047) at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:513) at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:528) at com.sun.jna.Native.invokeInt(Native Method) at com.sun.jna.Function.invoke(Function.java:390) at com.sun.jna.Function.invoke(Function.java:323) at com.sun.jna.Function.invoke(Function.java:275) at com.sun.jna.Function.invoke(Function.java:266) at com.sun.jna.platform.win32.COM.COMInvoker._invokeNativeObject(COMInvoker.java:37) at com.sun.jna.platform.win32.COM.ConnectionPoint.Advise(ConnectionPoint.java:42) at com.sun.jna.platform.win32.COM.ComEventCallbacks_Test.cause_Quit_Event(ComEventCallbacks_Test.java:236) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:38) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:532) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1179) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:1030)
Configuration menu - View commit details
-
Copy full SHA for 95d845c - Browse repository at this point
Copy the full SHA 95d845cView commit details -
Make (Un)marshalling context sensitive
Depending on the context the unmarshalling of the supplied data in callbacks is unwrapped further than before. The NavigateComplete2 event from the interface DWebBrowserEvents2 demonstrates this. The URL is passed as a Variant pointing to a Variant containing the string. Without this fix NULL is returned. To test this ComEventCallbacks_Test.java was moved to use Internet Explorer instead of MS Office.
Configuration menu - View commit details
-
Copy full SHA for 3602338 - Browse repository at this point
Copy the full SHA 3602338View commit details -
Move callback invocation in c.s.j.p.w.C.util.CallbackProxy into calli…
…ng thread Dispatching the invocation of the callback handler into an executor makes it impossible to fill [out] parameters, as the return has already happend and [in] parameters can not be savely used if they are not marshalled to java code because the calling code will free the parameters after the call. To prevent deadlocks ComThread is modified to allow COM calls from the callback by modifying the ComThread helper to only dispatch the COM call into the ComThread only if the calling thread has not COM already enabled. Reference counting was modified, so that now on construction of a ProxyObject the reference count is AddRef'ed once and Released once on finalization.
Configuration menu - View commit details
-
Copy full SHA for 334ae3f - Browse repository at this point
Copy the full SHA 334ae3fView commit details -
According to MSDN the caller is responsible to free BSTRs.
Configuration menu - View commit details
-
Copy full SHA for 78e6d0f - Browse repository at this point
Copy the full SHA 78e6d0fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad12bf7 - Browse repository at this point
Copy the full SHA ad12bf7View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.