Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 58 forks source link

Application lock-up when invalid icon image used on default look and feel decorated windows #122

Open darrenscott opened 10 years ago

darrenscott commented 10 years ago

It's possible to get an application using default look and feel decorated frames/dialogs to enter an infinite loop if the window icon configured is invalid.

I was able to reproduce this with the following short, self contained, correct example:

package com.darrenscott;

import javax.swing.*;
import java.awt.*;
import org.pushingpixels.substance.api.skin.SubstanceGraphiteGlassLookAndFeel;

public class SubstanceLockUpExample {

  public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        try {
          UIManager.setLookAndFeel(new SubstanceGraphiteGlassLookAndFeel());
          JFrame.setDefaultLookAndFeelDecorated(true);
          JFrame frame = new JFrame("Substance Lock-Up Example");
          frame.setIconImage(Toolkit.getDefaultToolkit().getImage("this-image-file-does-not-exist.png"));
          frame.setSize(new Dimension(300, 200));
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
        } catch (UnsupportedLookAndFeelException e) {
          e.printStackTrace();
        }
      }
    });
  }
}

At the point of attempting to show the frame, nothing appears and the code enters an infinite loop. This problem only occurs if defaultLookAndFeelDecorated is true; it works fine if it is false.

The offending code appears to be the updateAppIcon() method in SubstanceTitlePane. If the value returned from the call to SubstanceCoreUtilities.getScaledIconImage() is null, the containing while loop repeats indefinitely.

shemnon commented 10 years ago

I don't have the time to maintain this project, and I am currently looking for a new maintainer.

http://speling.shemnon.com/blog/2013/06/08/insubstantial-needs-a-new-maintainer/