[glib/glib-2-44] gapplication: Stop handle-local-options emission on errors



commit c7f393bba312015296ae1e0c2299c804bd56c006
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Sun Jun 21 10:51:50 2015 +0200

    gapplication: Stop handle-local-options emission on errors
    
    A signal accumulator can return TRUE to continue signal emission, and
    FALSE to stop signal emission. handle-local-options callbacks can return
    « return a non-negative option if you have handled your options and
    want to exit the process ».
    
    Currently, g_application_handle_local_options_accumulator (the
    accumulator for the handle-local-options signal) returns TRUE on
    non-negative return value (ie continue signal emission), and returns
    FALSE on negative return values (ie when the default option processing
    should continue).
    This return value seems backward as on >= 0 values, subsequent
    handle-local-options callbacks could overwrite the 'exit request' from
    the handler, while on < 0 values, the handle-local-options processing
    could end up early if several callbacks are listening for this signal.
    In particular, the default handler for this signal
    (g_application_real_handle_local_options) always returns -1 and will
    overwrite >= 0 return values from other handlers.
    
    This commit inverts the check so that signal emission stops early when
    one of the handle-local-options callbacks indicates it wants processing
    to stop and the process to exit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751598

 gio/gapplication.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index be7127a..6a82471 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -1279,7 +1279,7 @@ g_application_handle_local_options_accumulator (GSignalInvocationHint *ihint,
   value = g_value_get_int (handler_return);
   g_value_set_int (return_accu, value);
 
-  return value >= 0;
+  return value < 0;
 }
 
 static void


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