[smuxi: 170/179] Frontend-GNOME: use background thread for remoting call in Entry.ProcessKey()



commit 58f5e0720ee4717630372564b143ce028fd7e16d
Author: Mirco Bauer <meebey meebey net>
Date:   Thu Oct 5 16:40:14 2017 +0800

    Frontend-GNOME: use background thread for remoting call in Entry.ProcessKey()
    
    In Entry.ProcessKey() the FrontendManager.NextProtocolManager() call is a
    remoting call. Since Entry.ProcessKey() is executed in the GUI thread we don't
    want to block the GUI and thus do it in a background thread instead.

 src/Frontend-GNOME/Entry.cs |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/Frontend-GNOME/Entry.cs b/src/Frontend-GNOME/Entry.cs
index 1c07795..61c623a 100644
--- a/src/Frontend-GNOME/Entry.cs
+++ b/src/Frontend-GNOME/Entry.cs
@@ -1,7 +1,7 @@
 /*
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2013 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2015, 2017 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -268,7 +268,14 @@ namespace Smuxi.Frontend.Gnome
                     case Gdk.Key.x:
                     case Gdk.Key.X:
                         if (ChatViewManager.CurrentChatView is SessionChatView) {
-                            Frontend.FrontendManager.NextProtocolManager();
+                            ThreadPool.QueueUserWorkItem(delegate {
+                                try {
+                                    // REMOTING CALL
+                                    Frontend.FrontendManager.NextProtocolManager();
+                                } catch (Exception ex) {
+                                    Frontend.ShowException(ex);
+                                }
+                            });
                         } else {
                             // don't break cut
                             e.RetVal = false;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]