qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs unix.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs unix.c
Date: Tue, 04 Mar 2014 00:39:30 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/03/04 00:39:30

Modified files:
        .              : unix.c 

Log message:
        Fix crash bug on shell output buffers
        
        * add extra checks on callback function pointers in url_block()
          because a callback may unregister another callback.  This was causing
          crash bugs when deleting a running shell output buffer such as a
          buffer with a huge compressed file while it decompresses.
        
        * XXX: should break from the loop if callback changed the
               structures but need further investigation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/unix.c?cvsroot=qemacs&r1=1.8&r2=1.9

Patches:
Index: unix.c
===================================================================
RCS file: /sources/qemacs/qemacs/unix.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- unix.c      23 Jan 2014 12:56:23 -0000      1.8
+++ unix.c      4 Mar 2014 00:39:30 -0000       1.9
@@ -266,14 +266,21 @@
     ret = select(url_fdmax + 1, &rfds, &wfds, NULL, &tv);
 
     /* call each handler */
+    /* extra checks on callback function pointers because a callback
+     * may unregister another callback.  This was causing crash bugs
+     * when deleting a running shell output buffer such as a buffer
+     * with a huge compressed file while it decompresses.
+     * XXX: should break from the loop if callback changed the
+     *      structures but need further investigation.
+     */
     if (ret > 0) {
         uh = url_handlers;
         for (i = 0;i <= url_fdmax; i++) {
-            if (FD_ISSET(i, &rfds)) {
+            if (FD_ISSET(i, &rfds) && uh->read_cb) {
                 uh->read_cb(uh->read_opaque);
                 call_bottom_halves();
             }
-            if (FD_ISSET(i, &wfds)) {
+            if (FD_ISSET(i, &wfds) && uh->write_cb) {
                 uh->write_cb(uh->write_opaque);
                 call_bottom_halves();
             }
@@ -293,7 +300,7 @@
         if (pid <= 0)
             break;
         list_for_each_safe(ph, ph1, &pid_handlers) {
-            if (ph->pid == pid) {
+            if (ph->pid == pid && ph->cb) {
                 ph->cb(ph->opaque, status);
                 call_bottom_halves();
                 break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]