[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] [patch] fix memory image source handling in GTK peers
From: |
Thomas Fitzsimmons |
Subject: |
Re: [cp-patches] [patch] fix memory image source handling in GTK peers |
Date: |
Tue, 26 Jul 2005 12:16:55 -0400 |
On Tue, 2005-07-26 at 07:48 +0200, Mark Wielaard wrote:
> I don't think you want to create a (non-daemon) Timer each and every
> time here. That means that on each repaint() a new Thread is created
> which is never destroyed and which will prevent the application to ever
> stop since the Timers will be live. Try to either create a reusable
> (daemon) Timer that is used for all repaints. And/Or add a TimerTask to
> cancel the Timer after it hasn't been used for a while.
OK, committed the attached patch.
Thanks,
Tom
2005-07-26 Thomas Fitzsimmons <address@hidden>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (repaint): Reuse
repaint timer across repaint calls.
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v
retrieving revision 1.89
diff -u -u -r1.89 GtkComponentPeer.java
--- gnu/java/awt/peer/gtk/GtkComponentPeer.java 26 Jul 2005 01:53:24 -0000
1.89
+++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 26 Jul 2005 16:13:35 -0000
@@ -85,6 +85,8 @@
boolean isInRepaint;
+ Timer repaintTimer = new Timer();
+
/* this isEnabled differs from Component.isEnabled, in that it
knows if a parent is disabled. In that case Component.isEnabled
may return true, but our isEnabled will always return false */
@@ -374,9 +376,7 @@
if (x == 0 && y == 0 && width == 0 && height == 0)
return;
- Timer t = new Timer();
-
- t.schedule(new RepaintTimerTask(x, y, width, height), tm);
+ repaintTimer.schedule(new RepaintTimerTask(x, y, width, height), tm);
}
private class RepaintTimerTask extends TimerTask