[gtk+] GtkApplicationWindow: give up on handling dispose



commit bc3867eb8512406223e2291168b9c2042b7350cc
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Jan 14 10:33:13 2014 -0500

    GtkApplicationWindow: give up on handling dispose
    
    Stop trying to deal with "theoretical possibilities".
    
    We can't possibly continue to be a faithful GActionGroup implementation
    across dispose because dispose has a side effect of removing everyone's
    signal handlers.
    
    The code that we ran after the dispose chainup to do all of the fancy
    signal emulation was therefore dead.  The test that aimed to verify this
    was buggy itself due to an uninitialised variable, so really, it never
    worked at all.
    
    We keep the re-ordering of the chainup from the original commit to avoid having
    trouble with GtkActionMuxer and keep the checks in place that will prevent an
    outright segfault in the case that someone else tries to use the interface
    post-dispose.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722189

 gtk/gtkapplicationwindow.c           |   45 +------------------
 testsuite/gtk/Makefile.am            |    1 -
 testsuite/gtk/gtkapplicationwindow.c |   81 ----------------------------------
 3 files changed, 2 insertions(+), 125 deletions(-)
---
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index 4e2a1b7..93f1267 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -771,50 +771,9 @@ gtk_application_window_dispose (GObject *object)
    * handler of GtkWindow).
    *
    * That reduces our chances of being watched as a GActionGroup from a
-   * muxer constructed by GtkApplication.  Even still, it's
-   * theoretically possible that someone else could be watching us.
-   * Therefore, we have to take care to ensure that we don't violate our
-   * obligations under the interface of GActionGroup.
-   *
-   * The easiest thing is just for us to act as if all of the actions
-   * suddenly disappeared.
+   * muxer constructed by GtkApplication.
    */
-  if (window->priv->actions)
-    {
-      gchar **action_names;
-      guint signal;
-      gint i;
-
-      /* Only send the remove signals if someone is listening */
-      signal = g_signal_lookup ("action-removed", G_TYPE_ACTION_GROUP);
-      if (signal && g_signal_has_handler_pending (window, signal, 0, TRUE))
-        /* need to send a removed signal for each action */
-        action_names = g_action_group_list_actions (G_ACTION_GROUP (window->priv->actions));
-      else
-        /* don't need to send signals: nobody is watching */
-        action_names = NULL;
-
-      /* Free the group before sending the signals for two reasons:
-       *
-       *  1) we want any incoming calls to see an empty group
-       *
-       *  2) we don't want signal handlers that trigger in response to
-       *     the action-removed signals that we're firing to attempt to
-       *     modify the action group in a way that may cause it to fire
-       *     additional signals (which we would then propagate)
-       */
-      g_object_unref (window->priv->actions);
-      window->priv->actions = NULL;
-
-      /* It's safe to send the signals now, if we need to. */
-      if (action_names)
-        {
-          for (i = 0; action_names[i]; i++)
-            g_action_group_action_removed (G_ACTION_GROUP (window), action_names[i]);
-
-          g_strfreev (action_names);
-        }
-    }
+  g_clear_object (&window->priv->actions);
 }
 
 static void
diff --git a/testsuite/gtk/Makefile.am b/testsuite/gtk/Makefile.am
index daefbff..077b4f3 100644
--- a/testsuite/gtk/Makefile.am
+++ b/testsuite/gtk/Makefile.am
@@ -39,7 +39,6 @@ TEST_PROGS +=                         \
        floating                \
        grid                    \
        gtkmenu                 \
-       gtkapplicationwindow    \
        keyhash                 \
        listbox                 \
        no-gtk-init             \


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