Skip to content

Commit

Permalink
Merge pull request #422 from christian-baumann/420-FXClassloader-adap…
Browse files Browse the repository at this point in the history
…ter-hook-termination-problem

refs #420 - FXClassloader adapter hook: Application is not terminating
  • Loading branch information
tomsontom authored Jan 19, 2021
2 parents c5fb5ff + 5a8e22f commit 8d3355b
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,6 @@ private Class<?> findClassJavaFX11(String name, ModuleClassLoader moduleClassLoa
if( ! modules.isEmpty() ) {
this.j11Classloader = layer.findLoader(modules.iterator().next().getName());
this.j11ModulePackages = modules.stream().flatMap( m -> m.getPackages().stream()).collect(Collectors.toSet());

if( getSWTClassloader(this.frameworkContext) != null ) {
if (FXClassloaderConfigurator.DEBUG) {
System.err.println("FXClassLoader#findClassJavaFX11 - We run inside SWT don't let the platform quit automatically" ); //$NON-NLS-1$
}
try {
this.j11Classloader.loadClass("javafx.application.Platform") //$NON-NLS-1$
.getDeclaredMethod("setImplicitExit", boolean.class).invoke(null, Boolean.FALSE);//$NON-NLS-1$
} catch (Throwable e) {
e.printStackTrace();
}
}
} else {
return null;
}
Expand All @@ -233,6 +221,18 @@ private Class<?> findClassJavaFX11(String name, ModuleClassLoader moduleClassLoa
if (FXClassloaderConfigurator.DEBUG) {
System.err.println("FXClassLoader#findClassJavaFX11 - Using classloader " + this.j11Classloader); //$NON-NLS-1$
}

if (name.startsWith("javafx.embed.swt")) { //$NON-NLS-1$
try {
if (FXClassloaderConfigurator.DEBUG) {
System.err.println("FXClassLoader#findClassJavaFX11 - We are using SWT FXCanvas - don't let the platform quit automatically" ); //$NON-NLS-1$
}
this.j11Classloader.loadClass("javafx.application.Platform") //$NON-NLS-1$
.getDeclaredMethod("setImplicitExit", boolean.class).invoke(null, Boolean.FALSE);//$NON-NLS-1$
} catch (Throwable e) {
e.printStackTrace();
}
}

int lastIndexOf = name.lastIndexOf('.');
Class<?> loadedClass = null;
Expand Down

0 comments on commit 8d3355b

Please sign in to comment.