dmusican / Elegit

A GUI client for people who want to learn Git.
MIT License
30 stars 7 forks source link

Bug: Infinite Loop when opening a repo that no longer exists #498

Open sauerberg opened 7 years ago

sauerberg commented 7 years ago

If you try to open a Repo that no longer exists where Elegit thinks it does, the program will run into an infinite loop and eat up a ton of resources until it eventually runs out of memory and crashes. If the default repo to open on startup doesn't exist, the program runs in the background for several minutes before crashing.

dmusican commented 7 years ago

This bug has been put aside, but here our some possible directions @MarthanielX came across as he looked through it:

RepoHelper:getRepo: should it check to make sure that the repo exists, or is that already being done elsewhere?

SessionModel:loadMostRecentRepoHelper: this may relate to the problem in some way. In a comment, @MarthanielX says:

seems like this should be catching the error on windows as well but aparently its not On Mac: When last opened repo has been deleted, it handles the exception and simply moves along to the next previously opened one because of the for loop in loadRecentRepoHelpersFromStoredPathStrings()

Still: Is it better to be using exceptions to handle this than to actually use RepoHelper.exists() as intended?
dmusican commented 7 years ago

@MarthanielX also says for

SessionModel:getAllChangedRepoFiles: Fix bug where an interior for loop infinite loops if the default repo no longer exists