[vte] widget: Move some methods to VteTerminalPrivate



commit b3af4d814b2ecf592071d7d3d93e5002a87705f7
Author: Christian Persch <chpe gnome org>
Date:   Sun Jan 31 15:08:45 2016 +0100

    widget: Move some methods to VteTerminalPrivate

 src/vte.cc |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 7196f31..2adc164 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -3325,18 +3325,20 @@ not_inserted:
 }
 
 static void
-vte_terminal_child_watch_cb(GPid pid,
-                            int status,
-                            VteTerminal *terminal)
+child_watch_cb(GPid pid,
+               int status,
+               VteTerminalPrivate *that)
 {
-       if (terminal == NULL) {
-               /* The child outlived VteTerminal. Do nothing, we're happy that Glib
+       if (that == NULL) {
+               /* The child outlived us. Do nothing, we're happy that Glib
                 * read its exit data and hence it's no longer there as zombie. */
                return;
        }
 
+        auto terminal = that->m_terminal;
+        /* keep the VteTerminalPrivate in a death grip */
         g_object_ref(terminal);
-        terminal->pvt->child_watch_done(pid, status);
+        that->child_watch_done(pid, status);
         g_object_unref(terminal);
         /* Note: terminal may be destroyed at this point */
 }
@@ -3510,8 +3512,8 @@ VteTerminalPrivate::watch_child (GPid child_pid)
         m_child_watch_source =
                 g_child_watch_add_full(G_PRIORITY_HIGH,
                                        child_pid,
-                                       (GChildWatchFunc)vte_terminal_child_watch_cb,
-                                       m_terminal, NULL);
+                                       (GChildWatchFunc)child_watch_cb,
+                                       this, nullptr);
 
         /* FIXMEchpe: call vte_terminal_set_size here? */
 
@@ -8435,7 +8437,7 @@ VteTerminalPrivate::~VteTerminalPrivate()
                 m_child_watch_source = 0;
                 g_child_watch_add_full(G_PRIORITY_HIGH,
                                        m_pty_pid,
-                                       (GChildWatchFunc)vte_terminal_child_watch_cb,
+                                       (GChildWatchFunc)child_watch_cb,
                                        NULL, NULL);
         }
 


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