Review request for 8157002: Toggle gtk version if SWT used via FXCanvas
semyon.sadetsky at oracle.com
Wed Nov 23 17:27:27 UTC 2016
On 23.11.2016 19:29, Tom Schindl wrote:
> Ok. I think I got it:
> a) if SWT is loaded first (which is th 99% case I guess) then you are
> finding out that you need to run with gtk2 or gtk3 by finding out
> what gtk libs are already loaded (webref
> b) if JavaFX is loaded before SWT but SWT is on the classpath then you
> try to findout what SWT will load and align with that (webref
> If that is correct all my concerns are addressed! There's one very
> unlikely case:
> a) one creates an OSGi-Application
It is possible that SWT lib is added to an another OSGi bundle classpath
which is not accessible. Since all OSGi bundles share the same process
it may cause the GTK version conflict. I think we cannot resolve this
issue for OSGi and for all other custom ClassLoader hierarchies.
> b) one loads a JavaFX UI
> c) loads an SWT-UI
> Both webrefs won't address this case if not mistaken, but I have never
> seen an application like that ;-)
> On 23.11.16 13:32, Semyon Sadetsky wrote:
>> On 11/23/2016 12:38 PM, Tom Schindl wrote:
>>> From looking at the code I doubt your fix will work reliably in a
>>> OSGi-Environment who is the Main deployment scenario for SWT and hence
>>> For sure you won't find the SWT-Library on the SystemClassloader and
>>> whether you find it on the Thread-ContextClassloader is just gambling!
>>> The only area you for sure can detect the swt-library are the
>>> swt-fx.jar-Classes because those are guaranteed to be loaded with a
>>> classloader who can look up SWT-Libary classes like
>> What is swt-fx.jar? Maybe you meant javafx-swt.jar?
>>> BTW: Is the statement below really correct?
>>> .... in JFX embeded into SWT scenarios JFX loads GTK primarily ...
>>> If you create an instance of FXCanvas SWT must have been loaded already
>>> (You need to pass a parent Composite) so the native gtk-libs are there
>>> already loaded.
>> That's right concern. Actually the fix covers the scenario when swt.jar
>> is on the classpath and may be potentially loaded in future with another
>> GTK version (which will cause the process crash). The rest scenarios are
>> covered by the 8156491 fix which I just posted for review.
>>> On 22.11.16 14:51, Semyon Sadetsky wrote:
>>>> Hello Kevin & David,
>>>> Please review the fix for jfx9:
>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8157002
>>>> webrev: http://cr.openjdk.java.net/~ssadetsky/8157002/webrev.00/
>>>> In JFX embeded into SWT scenarios JFX loads GTK primarily. So SWT GTK
>>>> version cannot be detected using the check for the loaded native library
>>>> The fix proposes a way to detect if GTK version of swt.jar library is
>>>> available on the classpath and tries to get the GTK version from SWT lib
>>>> internal java classes.
More information about the openjfx-dev