Changes between Initial Version and Version 1 of Ticket #15574, comment 14


Ignore:
Timestamp:
2017-12-03T23:42:21+01:00 (8 years ago)
Author:
cmuelle8

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15574, comment 14

    initial v1  
    11@Don-vip:  I've noticed on jenkins four warnings classified high priority (BAD STYLE) for ImageDisplay.java - to make findbugs happy, please use this follow-up patch.  In theory we should not have more than one ImageDisplay instance, but it may have some relevance if this class is ever used more often than once.
    22
     3EDIT: added fixes to findbug rants introduced with r13191, see [https://josm.openstreetmap.de/jenkins/job/JOSM/3595/findbugsResult/new/].  There are also warnings about the usage of {{{System.gc()}}}, do you think its ok to work with {{{@SupressFBWarning ..}}} in these cases to ignore them?  They should be called at times, when performance is degraded anyway due to error or caught outOfMem condition.
    34{{{
    45  #!patch
     
    3435      * Manage the visible rectangle of an image with full bounds stored in init.
    3536      * @since 13127
     37@@ -230,8 +239,8 @@
     38                 ((infoflags & ImageObserver.HEIGHT) == ImageObserver.HEIGHT)) {
     39                 this.width = width;
     40                 this.height = height;
     41-                synchronized (this) {
     42-                    this.notify();
     43+                synchronized (ImageDisplay.this) {
     44+                    ImageDisplay.this.notifyAll();
     45                     return false;
     46                 }
     47             }
     48@@ -242,14 +251,14 @@
     49         public void run() {
     50             Image img = Toolkit.getDefaultToolkit().createImage(file.getPath());
     51 
     52-            synchronized (this) {
     53+            synchronized (ImageDisplay.this) {
     54                 width = -1;
     55                 img.getWidth(this);
     56                 img.getHeight(this);
     57 
     58                 while (width < 0) {
     59                     try {
     60-                        this.wait();
     61+                        ImageDisplay.this.wait();
     62                         if (width < 0) {
     63                             errorLoading = true;
     64                             return;
     65@@ -566,10 +575,12 @@
     66         public void mouseReleased(MouseEvent e) {
     67             File file;
     68             Image image;
     69+            VisRect visibleRect;
     70 
     71             synchronized (ImageDisplay.this) {
     72                 file = ImageDisplay.this.file;
     73                 image = ImageDisplay.this.image;
     74+                visibleRect = ImageDisplay.this.visibleRect;
     75             }
     76 
     77             if (image == null)
    3678}}}