[vte/vte-next: 6/114] Das Terminal und der Tod



commit d65a89428ebfd292dcd8d64db20ce69435daf2d7
Author: Christian Persch <chpe gnome org>
Date:   Mon May 2 20:47:11 2011 +0200

    Das Terminal und der Tod
    
    Bug #112172.

 doc/reference/vte-docs.xml     |    4 -
 doc/reference/vte-sections.txt |   17 ---
 doc/reference/vte.types        |    2 -
 src/Makefile.am                |   11 +--
 src/reaper.c                   |  226 ----------------------------------------
 src/reaper.h                   |   75 -------------
 src/vte-private.h              |    3 +-
 src/vte.c                      |   52 +++------
 8 files changed, 21 insertions(+), 369 deletions(-)
---
diff --git a/doc/reference/vte-docs.xml b/doc/reference/vte-docs.xml
index e18b52f..9673537 100644
--- a/doc/reference/vte-docs.xml
+++ b/doc/reference/vte-docs.xml
@@ -66,10 +66,6 @@
       <title>Interna</title>
       <xi:include href="xml/vte-access.xml"/>
     </chapter>
-    <chapter id="deprecated-objects">
-      <title>Deprecated</title>
-      <xi:include href="xml/vte-reaper.xml"/>
-    </chapter>
   </part>
 
   <chapter id="object-hierarchy">
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 93f1397..296a455 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -219,20 +219,3 @@ VteTerminalAccessibleFactory
 VteTerminalAccessibleFactoryClass
 vte_terminal_accessible_factory_new
 </SECTION>
-
-<SECTION>
-<FILE>vte-reaper</FILE>
-<TITLE>VteReaper</TITLE>
-VteReaper
-vte_reaper_add_child
-vte_reaper_get
-
-<SUBSECTION Standard>
-VTE_IS_REAPER
-VTE_IS_REAPER_CLASS
-VTE_REAPER
-VTE_REAPER_CLASS
-VTE_REAPER_GET_CLASS
-VTE_TYPE_REAPER
-vte_reaper_get_type
-</SECTION>
diff --git a/doc/reference/vte.types b/doc/reference/vte.types
index 83b1aec..188643b 100644
--- a/doc/reference/vte.types
+++ b/doc/reference/vte.types
@@ -7,10 +7,8 @@
 #include "vteaccess.h"
 #include "vtepty.h"
 #include "vtetypebuiltins.h"
-#include "reaper.h"
 
 vte_pty_get_type
-vte_reaper_get_type
 vte_terminal_get_type
 vte_terminal_accessible_get_type
 vte_terminal_accessible_factory_get_type
diff --git a/src/Makefile.am b/src/Makefile.am
index 68b3acb..5daf20f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ EXTRA_DIST = iso2022.txt
 # The library
 
 headerdir = $(includedir)/vte-$(VTE_API_VERSION)/vte
-header_HEADERS = reaper.h vte.h vteaccess.h vtepty.h vtetypebuiltins.h vteversion.h vtedeprecated.h
+header_HEADERS = vte.h vteaccess.h vtepty.h vtetypebuiltins.h vteversion.h vtedeprecated.h
 
 lib_LTLIBRARIES = libvte VTE_LIBRARY_SUFFIX_U@.la
 
@@ -45,8 +45,6 @@ libvte VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
 	matcher.c \
 	matcher.h \
 	pty.c \
-	reaper.c \
-	reaper.h \
 	ring.c \
 	ring.h \
 	table.c \
@@ -102,7 +100,7 @@ libvte VTE_LIBRARY_SUFFIX_U@_la_LIBADD = $(VTE_LIBS)
 libvte VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
   $(VTE_LDFLAGS) \
 	-version-info $(LT_VERSION_INFO) \
-	-export-symbols-regex "^vte_terminal_.*|^vte_pty_.*|^vte_get_.*|^vte_reaper_.*|_vte_debug_.*" \
+	-export-symbols-regex "^vte_terminal_.*|^vte_pty_.*|^vte_get_.*|_vte_debug_.*" \
 	@LIBTOOL_EXPORT_OPTIONS@ @LIBTOOL_FLAGS@ \
 	$(AM_LDFLAGS)
 
@@ -198,7 +196,7 @@ EXTRA_DIST += $(noinst_SCRIPTS)
 TEST_SH = check-doc-syntax.sh
 EXTRA_DIST += $(TEST_SH)
 
-check_PROGRAMS = dumpkeys iso2022 reaper reflect-text-view reflect-vte mev ssfe table trie xticker vteconv vtetc
+check_PROGRAMS = dumpkeys iso2022 reflect-text-view reflect-vte mev ssfe table trie xticker vteconv vtetc
 TESTS = table trie $(TEST_SH)
 
 AM_CFLAGS = $(GLIB_CFLAGS)
@@ -311,9 +309,6 @@ trie_LDADD = $(VTE_LIBS)
 vtetc_SOURCES = vtetc.c vtetc.h debug.c debug.h
 vtetc_CPPFLAGS = -DTERMCAP_MAIN
 
-reaper_SOURCES = reaper.c reaper.h debug.c debug.h marshal.c marshal.h
-reaper_CPPFLAGS =  -DREAPER_MAIN -DLOCALEDIR='"$(localedir)"'
-
 vteconv_SOURCES = buffer.h debug.c debug.h vteconv.c vteconv.h
 vteconv_CPPFLAGS = -DVTECONV_MAIN
 vteconv_CFLAGS = $(VTE_CFLAGS)
diff --git a/src/vte-private.h b/src/vte-private.h
index 7f20fa7..fc44fa8 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -46,7 +46,6 @@
 #include "debug.h"
 #include "vteconv.h"
 #include "vtedraw.h"
-#include "reaper.h"
 #include "ring.h"
 #include "caps.h"
 
@@ -171,7 +170,7 @@ struct _VteTerminalPrivate {
 	guint pty_output_source;
 	gboolean pty_input_active;
 	GPid pty_pid;			/* pid of child using pty slave */
-	VteReaper *pty_reaper;
+	guint child_watch_source;
         int child_exit_status;
 
 	/* Input data queues. */
diff --git a/src/vte.c b/src/vte.c
index e8671ba..ef75190 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -3144,11 +3144,10 @@ not_inserted:
 	return line_wrapped;
 }
 
-/* Catch a VteReaper child-exited signal, and if it matches the one we're
- * looking for, emit one of our own. */
 static void
-vte_terminal_catch_child_exited(VteReaper *reaper, int pid, int status,
-				VteTerminal *terminal)
+vte_terminal_child_watch_cb(GPid pid,
+                            int status,
+                            VteTerminal *terminal)
 {
 	if (pid == terminal->pvt->pty_pid) {
                 GObject *object = G_OBJECT(terminal);
@@ -3169,14 +3168,8 @@ vte_terminal_catch_child_exited(VteReaper *reaper, int pid, int status,
 			}
 #endif
 		}
-		/* Disconnect from the reaper. */
-		if (terminal->pvt->pty_reaper != NULL) {
-			g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
-							     vte_terminal_catch_child_exited,
-							     terminal);
-			g_object_unref(terminal->pvt->pty_reaper);
-			terminal->pvt->pty_reaper = NULL;
-		}
+
+		terminal->pvt->child_watch_source = 0;
 		terminal->pvt->pty_pid = -1;
 
 		/* Close out the PTY. */
@@ -3334,7 +3327,6 @@ vte_terminal_watch_child (VteTerminal *terminal,
 {
         VteTerminalPrivate *pvt;
         GObject *object;
-        VteReaper *reaper;
 
         g_return_if_fail(VTE_IS_TERMINAL(terminal));
         g_return_if_fail(child_pid != -1);
@@ -3353,22 +3345,14 @@ vte_terminal_watch_child (VteTerminal *terminal,
         pvt->child_exit_status = 0;
 
         /* Catch a child-exited signal from the child pid. */
-        reaper = vte_reaper_get();
-        vte_reaper_add_child(child_pid);
-        if (reaper != pvt->pty_reaper) {
-                if (terminal->pvt->pty_reaper != NULL) {
-                        g_signal_handlers_disconnect_by_func(pvt->pty_reaper,
-                                        vte_terminal_catch_child_exited,
-                                        terminal);
-                        g_object_unref(pvt->pty_reaper);
-                }
-                g_signal_connect(reaper, "child-exited",
-                                G_CALLBACK(vte_terminal_catch_child_exited),
-                                terminal);
-                pvt->pty_reaper = reaper;
-        } else {
-                g_object_unref(reaper);
-	}
+        if (terminal->pvt->child_watch_source != 0) {
+                g_source_remove (terminal->pvt->child_watch_source);
+        }
+        terminal->pvt->child_watch_source =
+                g_child_watch_add_full(G_PRIORITY_HIGH,
+                                       child_pid,
+                                       (GChildWatchFunc)vte_terminal_child_watch_cb,
+                                       terminal, NULL);
 
         /* FIXMEchpe: call vte_terminal_set_size here? */
 
@@ -8642,12 +8626,10 @@ vte_terminal_finalize(GObject *object)
 	}
 
 	/* Stop listening for child-exited signals. */
-	if (terminal->pvt->pty_reaper != NULL) {
-		g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
-						     vte_terminal_catch_child_exited,
-						     terminal);
-		g_object_unref(terminal->pvt->pty_reaper);
-	}
+        if (terminal->pvt->child_watch_source != 0) {
+                g_source_remove (terminal->pvt->child_watch_source);
+                terminal->pvt->child_watch_source = 0;
+        }
 
 	/* Stop processing input. */
 	vte_terminal_stop_processing (terminal);



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