Fix deadlock in Jingle calls.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7809 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-03-29 21:58:47 +00:00
committed by derek
parent e2fbf073f7
commit 7b756bd1b6

View File

@ -14,7 +14,6 @@ import org.jivesoftware.resource.SparkRes;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.jingle.IncomingJingleSession;
import org.jivesoftware.smackx.jingle.JingleNegotiator;
import org.jivesoftware.smackx.jingle.JingleSession;
import org.jivesoftware.smackx.jingle.JingleSessionRequest;
import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener;
@ -23,11 +22,13 @@ import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
import org.jivesoftware.spark.SparkManager;
import org.jivesoftware.spark.ui.ChatRoom;
import org.jivesoftware.spark.ui.ChatRoomClosingListener;
import org.jivesoftware.spark.util.TaskEngine;
import org.jivesoftware.spark.util.SwingTimerTask;
import org.jivesoftware.spark.util.TaskEngine;
import org.jivesoftware.spark.util.log.Log;
import org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster;
import javax.swing.SwingUtilities;
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.GridBagConstraints;
@ -76,7 +77,8 @@ public class IncomingCall implements JingleSessionListener, ChatRoomClosingListe
// Accept the request
try {
session = request.accept();
} catch (XMPPException e) {
}
catch (XMPPException e) {
Log.error(e);
}
@ -117,33 +119,37 @@ public class IncomingCall implements JingleSessionListener, ChatRoomClosingListe
* Removes the JingleRoom from the ChatRoom.
*/
private void showCallEndedState() {
if (ringing != null) {
ringing.stop();
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (ringing != null) {
ringing.stop();
}
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
notificationUI.setTitle("Voice chat ended on " + formatter.format(new Date()));
notificationUI.setIcon(null);
notificationUI.showAlert(false);
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
notificationUI.setTitle("Voice chat ended on " + formatter.format(new Date()));
notificationUI.setIcon(null);
notificationUI.showAlert(false);
if (chatRoom != null) {
JingleRoom room = callMap.get(chatRoom);
if (room != null) {
chatRoom.getChatPanel().remove(room);
if (chatRoom != null) {
JingleRoom room = callMap.get(chatRoom);
if (room != null) {
chatRoom.getChatPanel().remove(room);
}
callMap.remove(chatRoom);
chatRoom.getChatPanel().invalidate();
chatRoom.getChatPanel().validate();
chatRoom.getChatPanel().repaint();
}
// Add state
JingleStateManager.getInstance().removeJingleSession(chatRoom);
// Notify state change
SparkManager.getChatManager().notifySparkTabHandlers(chatRoom);
}
callMap.remove(chatRoom);
chatRoom.getChatPanel().invalidate();
chatRoom.getChatPanel().validate();
chatRoom.getChatPanel().repaint();
}
// Add state
JingleStateManager.getInstance().removeJingleSession(chatRoom);
// Notify state change
SparkManager.getChatManager().notifySparkTabHandlers(chatRoom);
});
}
/**
@ -209,7 +215,7 @@ public class IncomingCall implements JingleSessionListener, ChatRoomClosingListe
});
incomingCall.getRejectButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
rejectIncomingCall();
}
});