Skip to content

Commit

Permalink
Fixed memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
jeisfeld committed Feb 1, 2017
1 parent aa01b3c commit 1e8c4f1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public final void initialize(final URL location, final ResourceBundle resources)
mBody.getChildren().add(mController.getRoot());
}

@Override
public final void close() {
mController.close();
super.close();
}

/**
* Checks if narrow display is required.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public final boolean isDirty() {
public final void initialize(final URL location, final ResourceBundle resources) {
}

@Override
public final void close() {
mControllerRight.close();
mControllerLeft.close();
super.close();
}

/**
* Setter for the eye photo pair. Initializes the view.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public final void addSubPage(final BaseController controller, final int paneInde
mSubPageRegistry.add(controller);
}
else {
position = unclosablePages();
position = unclosablePagesCount();
mSubPageRegistry.add(position, controller);
}

Expand Down Expand Up @@ -394,15 +394,15 @@ private void disableClose(final int position) {
* @return true if there is a page that can be closed.
*/
public final boolean hasClosablePage() {
return mSubPageRegistry.size() > unclosablePages();
return mSubPageRegistry.size() > unclosablePagesCount();
}

/**
* Get the number of unclosable pages.
*
* @return the number of unclosable pages.
*/
private int unclosablePages() {
private int unclosablePagesCount() {
int counter = 0;
for (BaseController controller : mSubPageRegistry) {
if (!controller.isCloseable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ public final void setEyePhoto(final EyePhoto eyePhoto) {
this.mEyePhoto = eyePhoto;

Image image = eyePhoto.getImage(Resolution.NORMAL);

if (image.getProgress() == 1) {
// image is already loaded from the start.
Platform.runLater(new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EyePhoto {
/**
* The maximum size of the image cache.
*/
private static final int MAX_IMAGE_CACHE = 3;
private static final int MAX_IMAGE_CACHE = 4;

/**
* Indicator if the file has already a formatted name.
Expand Down

0 comments on commit 1e8c4f1

Please sign in to comment.