Add slice to stack throws exception

This is the second time this week that my running instance of Fiji cannot add a slice to a single slice image. The exception reads:

(Fiji Is Just) ImageJ 2.0.0-rc-39/1.50a; Java 1.8.0_45-internal [64-bit]; Linux 3.19.0-28-generic; 19251MB of 89623MB (21%)

java.lang.IllegalArgumentException: adding a container to a container on a different GraphicsDevice
at java.awt.Component.checkGD(
at java.awt.Container.addImpl(
at java.awt.Container.add(
at ij.gui.ImageWindow.add(
at ij.gui.ImageWindow.<init>(
at ij.gui.StackWindow.<init>(
at ij.ImagePlus.setStack(
at ij.plugin.StackEditor.addSlice(
at ij.IJ.runPlugIn(
at ij.Executer.runCommand(

The symptom is that the window does not get a a slider to browse through the sections. Surprisingly, when I duplicate the window, it offers to copy itself as a stack with as many slices as I’ve attempted to add. The duplicate window does have the slider and several slices. Obviously some UI hickup for which duplicate and delete is a life saving workaround, but confusing anyways.

Looks like a known-and-still-open bug in Java:

The description says the bug “happens when you add a Component to a Container on another graphics device, without explicitly removing the Component from its previous parent.” So it might be possible to work around it in the ImageJ1 code.