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
Update MainLoader.java #56
Update MainLoader.java #56
Conversation
The thread that creates a WebBrowserController and a DropboxViewer is named and assigned to a variable. The start() method call is put on a separate line, which can easily be commented out. If browserThread.start(); is commented out, the thread isn't started, and I don't get the exceptions associated with the JxBrowser. On the other hand, the Vacuum + Exit fails; it seems to be cleaning something forever, until the application is forced to quit. Therefore, I haven't commented out start(). But I would like to, because the JxBrowser dependent functionality is not ready yet. It's better to write some unit tests that demonstrate a working WebBrowserController and a DropboxViewer before this thread is re-enabled.
It seems that very much is dependent on Main.webBrowser, and if it's null, there will be NullPointerExceptions everywhere. It would be good if as much as possible works both with and without the webBrowser. Suggestion: Let the type of Main.webBrowser be Optional, and take different actions depending on if it's present or empty. Then one source of NullPointerExceptions is removed. |
Sorry to keep them not merged so far but i need to carefully test them step by step when i have time . |
No problem, I don't think you are slow to merge. Having said that, this pull request is completely harmless, I have just introduced a named variable (for the thread). It's what I actually wanted to do, as the next step, namely not starting the thread (because it doesn't work), which was harmful. And it will take longer time to solve that problem. If I comment out the thread start, I don't get the error messages to the console that I usually get when I start the player. The problems come later, when I try to exit the player. I think there is a loop that try to close the non-existing browser, and it never terminates. |
The problem is here will nulls => XR3Player/src/main/java/com/goxr3plus/xr3player/application/MainExit.java Lines 88 to 110 in b222ce4
I should add if (!null) to ignore that WebBrowser instance . But i left it because i was supposingly going to fix the browser issue :) . |
I did some tests with changing the type of Main.webBrowser into an Optional<>, but it appeared to be complicated. But there were so many places where decisions needed to be made, and I didn't really know which choice was the right one. It would have been simpler, if this was not a global value, but passed from caller to called method as an argument, perhaps as dependency injection to constructors. Then the decisions could be taken at an earlier stage in the call change (at least sometimes). |
I think . if(Main.webBrowser!=null){
Main.webBrowser.disposeAllBrowsers();
} will fix the problem . |
If I do so, and comment out the statement that starts the browser thread (MainLoader.java, line 387 in my branch), I get the following error when I log in: aug. 29, 2019 6:42:08 EM com.goxr3plus.xr3player.database.DatabaseManager createDatabaseMissingTables But it doesn't prevent me from running the application, and you are right, your fix above solves the exit problem. |
I will remove the JxBrowser on the next version and disable some XR3Player features :( |
SHOULD i merge this :)? |
Yes. |
The thread that creates a WebBrowserController and a DropboxViewer is named and assigned to a variable. The start() method call is put on a separate line, which can easily be commented out.
If browserThread.start(); is commented out, the thread isn't started, and I don't get the exceptions associated with the JxBrowser.
On the other hand, the Vacuum + Exit fails; it seems to be cleaning something forever, until the application is forced to quit.
Therefore, I haven't commented out start(). But I would like to, because the JxBrowser dependent functionality is not ready yet. It's better to write some unit tests that demonstrate a working WebBrowserController and a DropboxViewer before this thread is re-enabled.
This pull request doesn't change the behavior at all.