mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
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:
@ -14,7 +14,6 @@ import org.jivesoftware.resource.SparkRes;
|
|||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
import org.jivesoftware.smackx.jingle.IncomingJingleSession;
|
import org.jivesoftware.smackx.jingle.IncomingJingleSession;
|
||||||
import org.jivesoftware.smackx.jingle.JingleNegotiator;
|
|
||||||
import org.jivesoftware.smackx.jingle.JingleSession;
|
import org.jivesoftware.smackx.jingle.JingleSession;
|
||||||
import org.jivesoftware.smackx.jingle.JingleSessionRequest;
|
import org.jivesoftware.smackx.jingle.JingleSessionRequest;
|
||||||
import org.jivesoftware.smackx.jingle.listeners.JingleSessionListener;
|
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.SparkManager;
|
||||||
import org.jivesoftware.spark.ui.ChatRoom;
|
import org.jivesoftware.spark.ui.ChatRoom;
|
||||||
import org.jivesoftware.spark.ui.ChatRoomClosingListener;
|
import org.jivesoftware.spark.ui.ChatRoomClosingListener;
|
||||||
import org.jivesoftware.spark.util.TaskEngine;
|
|
||||||
import org.jivesoftware.spark.util.SwingTimerTask;
|
import org.jivesoftware.spark.util.SwingTimerTask;
|
||||||
|
import org.jivesoftware.spark.util.TaskEngine;
|
||||||
import org.jivesoftware.spark.util.log.Log;
|
import org.jivesoftware.spark.util.log.Log;
|
||||||
import org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster;
|
import org.jivesoftware.sparkimpl.plugin.alerts.SparkToaster;
|
||||||
|
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.applet.AudioClip;
|
import java.applet.AudioClip;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
@ -76,7 +77,8 @@ public class IncomingCall implements JingleSessionListener, ChatRoomClosingListe
|
|||||||
// Accept the request
|
// Accept the request
|
||||||
try {
|
try {
|
||||||
session = request.accept();
|
session = request.accept();
|
||||||
} catch (XMPPException e) {
|
}
|
||||||
|
catch (XMPPException e) {
|
||||||
Log.error(e);
|
Log.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,33 +119,37 @@ public class IncomingCall implements JingleSessionListener, ChatRoomClosingListe
|
|||||||
* Removes the JingleRoom from the ChatRoom.
|
* Removes the JingleRoom from the ChatRoom.
|
||||||
*/
|
*/
|
||||||
private void showCallEndedState() {
|
private void showCallEndedState() {
|
||||||
if (ringing != null) {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
ringing.stop();
|
public void run() {
|
||||||
}
|
if (ringing != null) {
|
||||||
|
ringing.stop();
|
||||||
|
}
|
||||||
|
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
|
final SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy h:mm a");
|
||||||
notificationUI.setTitle("Voice chat ended on " + formatter.format(new Date()));
|
notificationUI.setTitle("Voice chat ended on " + formatter.format(new Date()));
|
||||||
notificationUI.setIcon(null);
|
notificationUI.setIcon(null);
|
||||||
notificationUI.showAlert(false);
|
notificationUI.showAlert(false);
|
||||||
|
|
||||||
|
|
||||||
if (chatRoom != null) {
|
if (chatRoom != null) {
|
||||||
JingleRoom room = callMap.get(chatRoom);
|
JingleRoom room = callMap.get(chatRoom);
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
chatRoom.getChatPanel().remove(room);
|
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() {
|
incomingCall.getRejectButton().addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
rejectIncomingCall();
|
rejectIncomingCall();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user