Changeset 1526


Ignore:
Timestamp:
05/06/20 10:52:22 (4 years ago)
Author:
bnemhaus
Message:

org.expeditee.gui.Browser ->
org.expeditee.items.widgets.JfxBrowser ->
Fixed exception that was sometimes happening when Expeditee was closed after a JfxBrowser had been in use. Issue was that JfxBrowser runs operations on JFXThread which needed to be shut down nicely. Sometimes when Expeditee gets closed, and the JfxBrowser had something run in another thread, an exception would be caused when the JFXThread got terminated unexpectedly while running something. The solution was to detect if the JfxBrowser ever gets used, and if it is used then Expeditee must nicely close JFX thread as part of its shut down process.

Location:
trunk/src/org/expeditee
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Browser.java

    r1521 r1526  
    4848import org.expeditee.items.ItemUtils;
    4949import org.expeditee.items.Text;
     50import org.expeditee.items.widgets.JfxBrowser;
    5051import org.expeditee.items.widgets.WidgetCacheManager;
    5152import org.expeditee.network.FrameShare;
     
    5758import org.expeditee.taskmanagement.SaveStateChangedEvent;
    5859import org.expeditee.taskmanagement.SaveStateChangedEventListener;
     60
     61import javafx.application.Platform;
    5962
    6063/**
     
    428431                                FrameShare.getInstance().finalise();
    429432                        }
    430 
     433                       
     434                        // Shut down the Java FX Platform. 
     435                        if (JfxBrowser.JFXBROWSER_IN_USE) {
     436                                MessageBay.displayMessage("Detected use of JFX Browser.  Stopping Java FX Platform...");
     437                                Platform.exit();
     438                        }
     439                       
    431440                        MessageBay.displayMessage("System exited");
    432441
     
    441450                        File file = new File(FrameIO.MESSAGES_PATH + "messages");
    442451                        file.mkdirs();
    443 
     452                       
    444453                        Browser._hasExited = true;
    445454                       
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r1102 r1526  
    103103public class JfxBrowser extends DataFrameWidget {
    104104       
     105        public static boolean JFXBROWSER_IN_USE = false;
     106       
    105107        private static final String BACK = "back";
    106108        private static final String FORWARD = "forward";
     
    136138               
    137139                Font.loadFont(ClassLoader.getSystemResourceAsStream("org/expeditee/assets/resources/fonts/FontAwesome/fontawesome-webfont.ttf"), 12);
    138                
    139140                try {
    140141                MouseEvent_x = MouseEvent.class.getDeclaredField("x");
     
    179180                        }
    180181                });
     182               
     183                JFXBROWSER_IN_USE = true;
    181184        }
    182185       
Note: See TracChangeset for help on using the changeset viewer.