[9] Review request for 8157002: Toggle gtk version if SWT used via FXCanvas

Tom Schindl tom.schindl at bestsolution.at
Wed Nov 23 16:29:19 UTC 2016


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
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
>> FXCanvas!
>> 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
>> "org.eclipse.swt.internal.gtk.OS"
> 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.
> --Semyon
>> Tom
>> 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
>>> version.
>>> 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.
>>> --Semyon

Thomas Schindl, CTO
BestSolution.at EDV Systemhaus GmbH
Eduard-Bodem-Gasse 5-7, A-6020 Innsbruck
Reg. Nr. FN 222302s am Firmenbuchgericht Innsbruck

More information about the openjfx-dev mailing list