From c68e79efcd3813a54343cf67243874c51134e102 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Tue, 25 Mar 2008 09:50:42 +0000 Subject: [PATCH] Open chat in the UI thread. --- .../gui/main/contactlist/ContactListPanel.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java index d002cb6ad..aad49a905 100755 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java @@ -38,7 +38,6 @@ public class ContactListPanel TypingNotificationsListener, ContactListListener { - private MainFrame mainFrame; private ContactList contactList; @@ -48,9 +47,9 @@ public class ContactListPanel private TypingTimer typingTimer = new TypingTimer(); private CommonRightButtonMenu commonRightButtonMenu; - + private Logger logger = Logger.getLogger(ContactListPanel.class); - + private ChatWindowManager chatWindowManager; /** @@ -316,7 +315,7 @@ public void messageReceived(MessageReceivedEvent evt) contactList.refreshContact(metaContact); // Obtain the corresponding chat panel. - MetaContactChatPanel chatPanel + final MetaContactChatPanel chatPanel = chatWindowManager.getContactChat( metaContact, protocolContact, message.getMessageUID()); @@ -342,8 +341,14 @@ else if(eventType == MessageReceivedEvent.SMS_MESSAGE_RECEIVED) messageType, message.getContent(), message.getContentType()); - // Opens the chat panel with the new message. - chatWindowManager.openChat(chatPanel, false); + // Opens the chat panel with the new message in the UI thread. + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + chatWindowManager.openChat(chatPanel, false); + } + }); // Fire notification String title = Messages.getI18NString("msgReceived",