[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: fix deadlock in GtkChoicePeer
From: |
Thomas Fitzsimmons |
Subject: |
[cp-patches] FYI: fix deadlock in GtkChoicePeer |
Date: |
Fri, 07 Oct 2005 19:44:58 -0400 |
Hi,
Anthony's MIDI demo exposed a deadlock in the GTK peers. This patch
fixes it by making sure that the selection callback doesn't call back
into the peers again.
Tom
2005-10-07 Thomas Fitzsimmons <address@hidden>
* gnu/java/awt/peer/gtk/GtkChoicePeer.java (postChoiceItemEvent):
Don't call select on the AWT Choice component.
* java/awt/Choice.java (processItemEvent): Set the selected index
without calling into the peers.
Index: gnu/java/awt/peer/gtk/GtkChoicePeer.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkChoicePeer.java,v
retrieving revision 1.24
diff -u -r1.24 GtkChoicePeer.java
--- gnu/java/awt/peer/gtk/GtkChoicePeer.java 25 Aug 2005 02:26:48 -0000
1.24
+++ gnu/java/awt/peer/gtk/GtkChoicePeer.java 7 Oct 2005 23:46:05 -0000
@@ -131,9 +131,6 @@
protected void postChoiceItemEvent (String label, int stateChange)
{
- // Must set our state before notifying listeners
- if (stateChange == ItemEvent.SELECTED)
- ((Choice) awtComponent).select (label);
postItemEvent (label, stateChange);
}
}
Index: java/awt/Choice.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Choice.java,v
retrieving revision 1.22
diff -u -r1.22 Choice.java
--- java/awt/Choice.java 2 Jul 2005 20:32:23 -0000 1.22
+++ java/awt/Choice.java 7 Oct 2005 23:46:05 -0000
@@ -565,6 +565,10 @@
protected void
processItemEvent(ItemEvent event)
{
+ int index = pItems.indexOf((String) event.getItem());
+ // Don't call back into the peers when selecting index here
+ if (event.getStateChange() == ItemEvent.SELECTED)
+ this.selectedIndex = index;
if (item_listeners != null)
item_listeners.itemStateChanged(event);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: fix deadlock in GtkChoicePeer,
Thomas Fitzsimmons <=