Fix a crash

This commit is contained in:
Matthias Clasen 2009-09-27 04:27:04 +00:00
parent 6f9c4e563f
commit fdc8b24835
2 changed files with 101 additions and 1 deletions

94
fix-anchors.patch Normal file
View File

@ -0,0 +1,94 @@
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 319b8ce..8c5d419 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1812,56 +1812,59 @@ allocate_child_widgets (GtkTextLayout *text_layout,
{
PangoLayout *layout = display->layout;
PangoLayoutIter *run_iter;
-
+
run_iter = pango_layout_get_iter (layout);
-
do
{
PangoLayoutRun *run = pango_layout_iter_get_run_readonly (run_iter);
-
+
if (run && is_shape (run))
{
gint byte_index;
GtkTextIter text_iter;
- GtkTextChildAnchor *anchor = 0;
- GList *widgets = 0;
-
- /* The pango iterator iterates in visual order.
+ GtkTextChildAnchor *anchor = NULL;
+ GList *widgets = NULL;
+ GList *l;
+
+ /* The pango iterator iterates in visual order.
* We use the byte index to find the child widget.
*/
-
byte_index = pango_layout_iter_get_index (run_iter);
line_display_index_to_iter (text_layout, display, &text_iter, byte_index, 0);
anchor = gtk_text_iter_get_child_anchor (&text_iter);
- widgets = gtk_text_child_anchor_get_widgets (anchor);
-
- if (widgets)
+ if (anchor)
+ widgets = gtk_text_child_anchor_get_widgets (anchor);
+
+ for (l = widgets; l; l = l->next)
{
PangoRectangle extents;
- GtkWidget *child = widgets->data;
+ GtkWidget *child = l->data;
- /* We emit "allocate_child" with the x,y of
- * the widget with respect to the top of the line
- * and the left side of the buffer
- */
-
- pango_layout_iter_get_run_extents (run_iter,
- NULL,
- &extents);
-
- g_signal_emit (text_layout,
- signals[ALLOCATE_CHILD],
- 0,
- child,
- PANGO_PIXELS (extents.x) + display->x_offset,
- PANGO_PIXELS (extents.y) + display->top_margin);
-
- g_list_free (widgets);
+ if (_gtk_anchored_child_get_layout (child) == text_layout)
+ {
+
+ /* We emit "allocate_child" with the x,y of
+ * the widget with respect to the top of the line
+ * and the left side of the buffer
+ */
+ pango_layout_iter_get_run_extents (run_iter,
+ NULL,
+ &extents);
+
+ g_signal_emit (text_layout,
+ signals[ALLOCATE_CHILD],
+ 0,
+ child,
+ PANGO_PIXELS (extents.x) + display->x_offset,
+ PANGO_PIXELS (extents.y) + display->top_margin);
+ }
}
+
+ g_list_free (widgets);
}
}
while (pango_layout_iter_next_run (run_iter));
-
+
pango_layout_iter_free (run_iter);
}

View File

@ -17,7 +17,7 @@
Summary: The GIMP ToolKit (GTK+), a library for creating GUIs for X
Name: gtk2
Version: %{base_version}
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: http://download.gnome.org/sources/gtk+/2.18/gtk+-%{version}.tar.bz2
@ -32,6 +32,8 @@ Patch0: gtk+-2.13.5-lib64.patch
Patch1: gtk2-printing-smb-auth.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=586207
Patch2: gtk2-printing-nonblocking-printer-list.patch
# from upstream
Patch3: fix-anchors.patch
BuildRequires: atk-devel >= %{atk_version}
BuildRequires: pango-devel >= %{pango_version}
@ -145,6 +147,7 @@ This package contains developer documentation for the GTK+ widget toolkit.
%patch0 -p1 -b .lib64
%patch1 -p1 -b .printing-smb-auth
%patch2 -p1 -b .printing-nonblocking-printer-list
%patch3 -p1 -b .fix-anchors
# make sure that gtkmarshalers.{c, h} get regenerated during the build
# - caused by print_authentication.patch
@ -386,6 +389,9 @@ fi
%changelog
* Sun Sep 27 2009 Matthias Clasen <mclasen@redhat.com> - 2.18.0-2
- Fix anchor handling in text views (#525910)
* Wed Sep 23 2009 Matthias Clasen <mclasen@redhat.com> - 2.18.0-1
- Update to 2.18.0
- Add some patches for improved printing support