Commit 49e58846 by Anthony Green Committed by Anthony Green

AbstractGraphicsState.java (clone): Handle CloneNotSupportedException.

2003-07-20  Anthony Green  <green@redhat.com>

	* gnu/awt/j2d/AbstractGraphicsState.java (clone): Handle
	CloneNotSupportedException.
	* gnu/gcj/xlib/WindowAttributes.java (clone): Ditto.
	* gnu/gcj/xlib/WMSizeHints.java (clone): Ditto.
	* gnu/gcj/xlib/GC.java (clone): Ditto.
	* gnu/awt/xlib/XGraphics.java (clone): Ditto.
	* gnu/awt/j2d/Graphics2DImpl.java (clone): Ditto.

	* gnu/awt/xlib/XEventLoop.java (postNextEvent): Remove unreachable
	handler.
	* gnu/gcj/runtime/NameFinder.java (NameFinder): Ditto.

From-SVN: r69623
parent 8ec88074
2003-07-20 Anthony Green <green@redhat.com>
* gnu/awt/j2d/AbstractGraphicsState.java (clone): Handle
CloneNotSupportedException.
* gnu/gcj/xlib/WindowAttributes.java (clone): Ditto.
* gnu/gcj/xlib/WMSizeHints.java (clone): Ditto.
* gnu/gcj/xlib/GC.java (clone): Ditto.
* gnu/awt/xlib/XGraphics.java (clone): Ditto.
* gnu/awt/j2d/Graphics2DImpl.java (clone): Ditto.
* gnu/awt/xlib/XEventLoop.java (postNextEvent): Remove unreachable
handler.
* gnu/gcj/runtime/NameFinder.java (NameFinder): Ditto.
2003-07-20 Steve Pribyl <steve@netfuel.com.> 2003-07-20 Steve Pribyl <steve@netfuel.com.>
* gnu/gcj/runtime/natSharedLibLoader.cc (init): `libname' now a * gnu/gcj/runtime/natSharedLibLoader.cc (init): `libname' now a
......
...@@ -128,6 +128,14 @@ public abstract class AbstractGraphicsState implements Cloneable ...@@ -128,6 +128,14 @@ public abstract class AbstractGraphicsState implements Cloneable
public Object clone () public Object clone ()
{ {
return super.clone (); try
{
return super.clone ();
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
} }
...@@ -105,12 +105,20 @@ public class Graphics2DImpl extends Graphics2D implements Cloneable ...@@ -105,12 +105,20 @@ public class Graphics2DImpl extends Graphics2D implements Cloneable
public Object clone() public Object clone()
{ {
Graphics2DImpl gfxCopy = (Graphics2DImpl) super.clone(); try
AbstractGraphicsState stateCopy = {
(AbstractGraphicsState) state.clone(); Graphics2DImpl gfxCopy = (Graphics2DImpl) super.clone();
gfxCopy.setState(stateCopy); AbstractGraphicsState stateCopy =
(AbstractGraphicsState) state.clone();
return gfxCopy; gfxCopy.setState(stateCopy);
return gfxCopy;
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
......
...@@ -48,17 +48,8 @@ public class XEventLoop implements Runnable ...@@ -48,17 +48,8 @@ public class XEventLoop implements Runnable
void postNextEvent() void postNextEvent()
{ {
try AWTEvent evt = getNextEvent();
{ queue.postEvent(evt);
AWTEvent evt = getNextEvent();
queue.postEvent(evt);
}
catch (InterruptedException ie)
{
// FIXME: what now?
System.err.println(ie);
}
} }
/** get next event. Will block until events become available. */ /** get next event. Will block until events become available. */
......
...@@ -46,10 +46,18 @@ public class XGraphics implements Cloneable, DirectRasterGraphics ...@@ -46,10 +46,18 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
public Object clone() public Object clone()
{ {
XGraphics gfxCopy = (XGraphics) super.clone(); try
gfxCopy.context = context.create(); {
XGraphics gfxCopy = (XGraphics) super.clone();
return gfxCopy; gfxCopy.context = context.create();
return gfxCopy;
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
public void dispose() public void dispose()
......
...@@ -154,18 +154,10 @@ public class NameFinder ...@@ -154,18 +154,10 @@ public class NameFinder
if (addr2line != null) if (addr2line != null)
{ {
try addr2lineIn = new BufferedReader
{ (new InputStreamReader(addr2line.getInputStream()));
addr2lineIn = new BufferedReader addr2lineOut = new BufferedWriter
(new InputStreamReader(addr2line.getInputStream())); (new OutputStreamWriter(addr2line.getOutputStream()));
addr2lineOut = new BufferedWriter
(new OutputStreamWriter(addr2line.getOutputStream()));
}
catch (IOException ioe)
{
addr2line.destroy();
addr2line = null;
}
} }
} }
} }
......
...@@ -36,15 +36,23 @@ public class GC implements Cloneable ...@@ -36,15 +36,23 @@ public class GC implements Cloneable
*/ */
public Object clone() public Object clone()
{ {
GC gcClone = target.getGCFromCache (); try
if (gcClone==null) {
{ GC gcClone = target.getGCFromCache ();
gcClone = (GC) super.clone(); if (gcClone==null)
gcClone.structure = null; {
} gcClone = (GC) super.clone();
gcClone.initStructure(this); gcClone.structure = null;
gcClone.updateClip(); }
return gcClone; gcClone.initStructure(this);
gcClone.updateClip();
return gcClone;
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
private native void initStructure(GC copyFrom); private native void initStructure(GC copyFrom);
......
...@@ -27,12 +27,20 @@ public class WMSizeHints implements Cloneable ...@@ -27,12 +27,20 @@ public class WMSizeHints implements Cloneable
protected native void finalize(); protected native void finalize();
public Object clone() { public Object clone() {
WMSizeHints hints = (WMSizeHints) super.clone(); try
// In case of an exception before the stucture is copied. {
hints.structure = null; WMSizeHints hints = (WMSizeHints) super.clone();
// In case of an exception before the stucture is copied.
hints.init(this); hints.structure = null;
return hints;
hints.init(this);
return hints;
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
public native void applyNormalHints(Window window); public native void applyNormalHints(Window window);
......
...@@ -43,15 +43,23 @@ public class WindowAttributes ...@@ -43,15 +43,23 @@ public class WindowAttributes
public Object clone() public Object clone()
{ {
WindowAttributes attributes = (WindowAttributes) super.clone(); try
// In case of an exception before the stucture is copied. {
attributes.in = null; WindowAttributes attributes = (WindowAttributes) super.clone();
attributes.out = null; // In case of an exception before the stucture is copied.
attributes.in = null;
// FIXME: do anything else? attributes.out = null;
// FIXME: do anything else?
attributes.init(this); attributes.init(this);
return attributes; return attributes;
}
catch (CloneNotSupportedException ex)
{
// This should never happen.
throw new InternalError ();
}
} }
public native void setBackground(long pixel); public native void setBackground(long pixel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment