qulogic/libgnt

Fix some timeout source removal and typing.

2019-05-19, Elliott Sales de Andrade
508138ca5113
Parents 7c922cd28b4f
Children 99622fd01fd2
Fix some timeout source removal and typing.

This fixes some warnings I get about removing a source with id == 0.
  • +13 -8
    gntmain.c
  • +1 -1
    gnttree.c
  • +3 -1
    gntwidget.c
  • +1 -2
    gntwm.c
  • --- a/gntmain.c Sun May 19 18:28:45 2019 -0400
    +++ b/gntmain.c Sun May 19 22:47:23 2019 -0400
    @@ -103,7 +103,7 @@
    #define HOLDING_ESCAPE (escape_stuff.timer != 0)
    static struct {
    - int timer;
    + guint timer;
    } escape_stuff;
    static gboolean
    @@ -270,7 +270,7 @@
    {
    /* XXX: it throws an error after evey io_invoke, I have no idea why */
    #ifndef _WIN32
    - int id = GPOINTER_TO_INT(data);
    + guint id = GPOINTER_TO_UINT(data);
    g_source_remove(id);
    g_io_channel_unref(source);
    @@ -438,7 +438,7 @@
    static void
    setup_io()
    {
    - int result;
    + guint result;
    #ifdef _WIN32
    channel = g_io_channel_win32_new_fd(STDIN_FILENO);
    @@ -457,9 +457,9 @@
    (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI),
    io_invoke, NULL, NULL);
    - channel_error_callback = g_io_add_watch_full(channel, G_PRIORITY_HIGH,
    - (G_IO_NVAL),
    - io_invoke_error, GINT_TO_POINTER(result), NULL);
    + channel_error_callback = g_io_add_watch_full(
    + channel, G_PRIORITY_HIGH, (G_IO_NVAL), io_invoke_error,
    + GUINT_TO_POINTER(result), NULL);
    g_io_channel_unref(channel);
    }
    @@ -776,8 +776,12 @@
    void gnt_quit()
    {
    /* Prevent io_invoke() from being called after wm is destroyed */
    - g_source_remove(channel_error_callback);
    - g_source_remove(channel_read_callback);
    + if (channel_error_callback) {
    + g_source_remove(channel_error_callback);
    + }
    + if (channel_read_callback) {
    + g_source_remove(channel_read_callback);
    + }
    channel_error_callback = 0;
    channel_read_callback = 0;
    @@ -907,6 +911,7 @@
    cp->callback = callback;
    cp->data = data;
    g_source_remove(channel_read_callback);
    + channel_read_callback = 0;
    gnt_wm_set_keypress_mode(wm, GNT_KP_MODE_WAIT_ON_CHILD);
    g_child_watch_add(pid, reap_child, cp);
    --- a/gnttree.c Sun May 19 18:28:45 2019 -0400
    +++ b/gnttree.c Sun May 19 22:47:23 2019 -0400
    @@ -90,7 +90,7 @@
    gboolean show_separator; /* Whether to show column separators */
    GString *search;
    - int search_timeout;
    + guint search_timeout;
    int search_column;
    gboolean (*search_func)(GntTree *tree, gpointer key, const char *search, const char *current);
    --- a/gntwidget.c Sun May 19 18:28:45 2019 -0400
    +++ b/gntwidget.c Sun May 19 22:47:23 2019 -0400
    @@ -123,7 +123,9 @@
    GntWidgetPrivate *priv = gnt_widget_get_instance_private(self);
    g_signal_emit(self, signals[SIG_DESTROY], 0);
    - g_source_remove(priv->queue_update);
    + if (priv->queue_update) {
    + g_source_remove(priv->queue_update);
    + }
    G_OBJECT_CLASS(gnt_widget_parent_class)->dispose(obj);
    }
    --- a/gntwm.c Sun May 19 18:28:45 2019 -0400
    +++ b/gntwm.c Sun May 19 22:47:23 2019 -0400
    @@ -144,7 +144,7 @@
    static void ensure_normal_mode(GntWMPrivate *priv);
    static gboolean write_already(gpointer data);
    -static int write_timeout;
    +static guint write_timeout;
    static time_t last_active_time;
    static gboolean idle_update;
    static GList *act = NULL; /* list of WS with unseen activitiy */
    @@ -2289,7 +2289,6 @@
    }
    g_free(filename);
    - g_source_remove(write_timeout);
    write_timeout = 0;
    return FALSE;
    }