File gtk3-bgo725733.patch of Package gtk3.4637
From 66fae0330c5cdb68f50699ff2645ff0cf112911e Mon Sep 17 00:00:00 2001
From: Benjamin Otte <otte@redhat.com>
Date: Fri, 7 Mar 2014 21:45:18 +0100
Subject: [PATCH] a11y: Don't use signals
Instead, call functions directly. Fixes the fact that the signals
weren't disconnected even when the accessible was destroyed.
https://bugzilla.gnome.org/show_bug.cgi?id=725733
Backported for 3.10 by Mike Gorse <mgorse2suse.com>
---
diff -urNp gtk+-3.10.9.orig/gtk/a11y/gtkcontaineraccessible.c gtk+-3.10.9/gtk/a11y/gtkcontaineraccessible.c
--- gtk+-3.10.9.orig/gtk/a11y/gtkcontaineraccessible.c 2014-05-12 13:11:28.000000000 -0500
+++ gtk+-3.10.9/gtk/a11y/gtkcontaineraccessible.c 2016-01-13 11:49:43.991992041 -0600
@@ -19,6 +19,8 @@
#include <gtk/gtk.h>
#include "gtkcontaineraccessible.h"
+#include "gtkcontaineraccessibleprivate.h"
+#include "gtkwidgetprivate.h"
struct _GtkContainerAccessiblePrivate
{
@@ -72,36 +74,43 @@ gtk_container_accessible_ref_child (AtkO
return accessible;
}
-static gint
-gtk_container_accessible_add_gtk (GtkContainer *container,
- GtkWidget *widget,
- gpointer data)
+void
+_gtk_container_accessible_add (GtkWidget *parent,
+ GtkWidget *child)
{
- GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data);
+ GtkContainerAccessible *accessible;
GtkContainerAccessibleClass *klass;
+ AtkObject *obj;
+
+ obj = _gtk_widget_peek_accessible (GTK_WIDGET (parent));
+ if (!GTK_IS_CONTAINER_ACCESSIBLE (obj))
+ return;
+
+ accessible = GTK_CONTAINER_ACCESSIBLE (obj);
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
if (klass->add_gtk)
- return klass->add_gtk (container, widget, data);
- else
- return 1;
+ klass->add_gtk (GTK_CONTAINER (parent), child, obj);
}
-static gint
-gtk_container_accessible_remove_gtk (GtkContainer *container,
- GtkWidget *widget,
- gpointer data)
+void
+_gtk_container_accessible_remove (GtkWidget *parent,
+ GtkWidget *child)
{
- GtkContainerAccessible *accessible = GTK_CONTAINER_ACCESSIBLE (data);
+ GtkContainerAccessible *accessible;
GtkContainerAccessibleClass *klass;
+ AtkObject *obj;
+ obj = _gtk_widget_peek_accessible (GTK_WIDGET (parent));
+ if (!GTK_IS_CONTAINER_ACCESSIBLE (obj))
+ return;
+
+ accessible = GTK_CONTAINER_ACCESSIBLE (obj);
klass = GTK_CONTAINER_ACCESSIBLE_GET_CLASS (accessible);
if (klass->remove_gtk)
- return klass->remove_gtk (container, widget, data);
- else
- return 1;
+ klass->remove_gtk (GTK_CONTAINER (parent), child, obj);
}
static gint
@@ -163,8 +172,6 @@ gtk_container_accessible_real_initialize
accessible->priv->children = gtk_container_get_children (GTK_CONTAINER (data));
- g_signal_connect (data, "add", G_CALLBACK (gtk_container_accessible_add_gtk), obj);
- g_signal_connect (data, "remove", G_CALLBACK (gtk_container_accessible_remove_gtk), obj);
obj->role = ATK_ROLE_PANEL;
}
diff -urNp gtk+-3.10.9.orig/gtk/a11y/gtkcontaineraccessibleprivate.h gtk+-3.10.9/gtk/a11y/gtkcontaineraccessibleprivate.h
--- gtk+-3.10.9.orig/gtk/a11y/gtkcontaineraccessibleprivate.h 1969-12-31 18:00:00.000000000 -0600
+++ gtk+-3.10.9/gtk/a11y/gtkcontaineraccessibleprivate.h 2016-01-13 11:45:11.207993078 -0600
@@ -0,0 +1,32 @@
+/* GTK+ - accessibility implementations
+ * Copyright (C) 2014 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
+#define __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
+
+#include <gtk/a11y/gtkcontaineraccessible.h>
+
+G_BEGIN_DECLS
+
+void _gtk_container_accessible_add (GtkWidget *parent,
+ GtkWidget *child);
+void _gtk_container_accessible_remove (GtkWidget *parent,
+ GtkWidget *child);
+
+G_END_DECLS
+
+#endif /* __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ */
diff -urNp gtk+-3.10.9.orig/gtk/a11y/Makefile.am gtk+-3.10.9/gtk/a11y/Makefile.am
--- gtk+-3.10.9.orig/gtk/a11y/Makefile.am 2014-05-12 13:11:28.000000000 -0500
+++ gtk+-3.10.9/gtk/a11y/Makefile.am 2016-01-13 11:46:10.531992852 -0600
@@ -109,6 +109,7 @@ gtka11y_private_h_sources = \
gtkaccessibilityutil.h \
gtkcellaccessibleprivate.h \
gtkcolorswatchaccessibleprivate.h \
+ gtkcontaineraccessibleprivate.h \
gtkiconviewaccessibleprivate.h \
gtklabelaccessibleprivate.h \
gtklistboxaccessibleprivate.h \
diff -urNp gtk+-3.10.9.orig/gtk/a11y/Makefile.in gtk+-3.10.9/gtk/a11y/Makefile.in
--- gtk+-3.10.9.orig/gtk/a11y/Makefile.in 2014-05-12 13:24:09.000000000 -0500
+++ gtk+-3.10.9/gtk/a11y/Makefile.in 2016-01-13 11:46:30.499992776 -0600
@@ -652,6 +652,7 @@ gtka11y_private_h_sources = \
gtkaccessibilityutil.h \
gtkcellaccessibleprivate.h \
gtkcolorswatchaccessibleprivate.h \
+ gtkcontaineraccessibleprivate.h \
gtkiconviewaccessibleprivate.h \
gtklabelaccessibleprivate.h \
gtklistboxaccessibleprivate.h \
diff -urNp gtk+-3.10.9.orig/gtk/gtkcontainer.c gtk+-3.10.9/gtk/gtkcontainer.c
--- gtk+-3.10.9.orig/gtk/gtkcontainer.c 2014-05-12 13:11:28.000000000 -0500
+++ gtk+-3.10.9/gtk/gtkcontainer.c 2016-01-13 12:07:56.135987890 -0600
@@ -50,6 +50,8 @@
#include "gtkstylecontextprivate.h"
#include "gtkwidgetpath.h"
#include "a11y/gtkcontaineraccessible.h"
+#include "a11y/gtkcontaineraccessibleprivate.h"
+#include "a11y/gtkcontaineraccessibleprivate.h"
/**
* SECTION:gtkcontainer
@@ -1548,6 +1550,8 @@ gtk_container_add (GtkContainer *contain
}
g_signal_emit (container, container_signals[ADD], 0, widget);
+
+ _gtk_container_accessible_add (GTK_WIDGET (container), widget);
}
/**
@@ -1573,7 +1577,13 @@ gtk_container_remove (GtkContainer *cont
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (gtk_widget_get_parent (widget) == GTK_WIDGET (container) || GTK_IS_ASSISTANT (container));
+ g_object_ref (widget);
+
g_signal_emit (container, container_signals[REMOVE], 0, widget);
+
+ _gtk_container_accessible_remove (GTK_WIDGET (container), widget);
+
+ g_object_unref (widget);
}
void