Hello,

Mario Torre wrote:
Il giorno ven, 21/07/2006 alle 17.05 -0400, Lillian Angel ha scritto:
I forgot to remove some unused fields in the last patch.

2006-07-20  Lillian Angel  <[EMAIL PROTECTED]>

        * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java:
        Removed unused fields.
        (GtkMouseDragGestureRecognizer): Removed initializations.

Hi!

I found an issue with the code, this is not related to your patch, as it
was already there, but can lead to threading issues if my understanding
is right.

What I think is that when the 4th GtkMouseDragGestureRecognizer
constructor registers the class as a listener, it exposes the 'this'
reference prior of returning from the constructor (thus on a
non-complete initialization).

This patch try to address this issue.

I need some comments because to solve that I have overrided two methods
in the base class elevating their visibility to public, which may not be
the correct way to handle this situation (the fact is that now users of
class GtkMouseDragGestureRecognizer need to explicitly register the
class as a listener).

Hope this works :)
This works well. Please feel free to commit this patch.

Thanks a lot!
Lillian

Mario

---

2006-07-22  Mario Torre  <[EMAIL PROTECTED]>

        * gnu/java/awt/peer/gtk/GtkToolkit.java (createDragGestureRecognizer):
        now explicity registerListeners on GtkMouseDragGestureRecognizer
        instance.
        * gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java
        (unregisterListeners): new method, overrided from base class
        to rise visibility (from protected to public).
        (registerListeners): Likewise.
        (GtkMouseDragGestureRecognizer): fixed potential threading issue:
        removed call to registerListeners from the constructor.

------------------------------------------------------------------------

### Eclipse Workspace Patch 1.0
#P classpath
Index: gnu/java/awt/peer/gtk/GtkToolkit.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v
retrieving revision 1.91
diff -u -r1.91 GtkToolkit.java
--- gnu/java/awt/peer/gtk/GtkToolkit.java       15 Jul 2006 08:02:23 -0000      
1.91
+++ gnu/java/awt/peer/gtk/GtkToolkit.java       21 Jul 2006 22:12:21 -0000
@@ -615,8 +615,16 @@
                                                            DragGestureListener 
l)
   {
     if (recognizer.getName().equals("java.awt.dnd.MouseDragGestureRecognizer"))
-      return new GtkMouseDragGestureRecognizer(ds, comp, actions, l);
-    return null;
+      {
+        GtkMouseDragGestureRecognizer gestureRecognizer
+          = new GtkMouseDragGestureRecognizer(ds, comp, actions, l);
+        gestureRecognizer.registerListeners();
+        return gestureRecognizer;
+      }
+    else
+      {
+        return null;
+      }
   }
public Map mapInputMethodHighlight(InputMethodHighlight highlight)
Index: gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java
===================================================================
RCS file: 
/sources/classpath/classpath/gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java,v
retrieving revision 1.3
diff -u -r1.3 GtkMouseDragGestureRecognizer.java
--- gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 21 Jul 2006 21:05:14 
-0000      1.3
+++ gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java 21 Jul 2006 22:12:20 
-0000
@@ -69,8 +69,16 @@
                                         DragGestureListener dgl)
   {
     super(ds, c, act, dgl);
- - registerListeners();
+  }
+ + public void registerListeners ()
+  {
+    super.registerListeners();
+  }
+ + public void unregisterListeners ()
+  {
+    super.unregisterListeners();
   }
public void mouseClicked (MouseEvent e)


Reply via email to