rpms/gtk2/devel fix-anchors.patch,NONE,1.1 gtk2.spec,1.405,1.406

Matthias Clasen mclasen at fedoraproject.org
Sun Sep 27 04:27:06 UTC 2009


Author: mclasen

Update of /cvs/pkgs/rpms/gtk2/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15175

Modified Files:
	gtk2.spec 
Added Files:
	fix-anchors.patch 
Log Message:
Fix a crash


fix-anchors.patch:
 gtktextlayout.c |   63 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

--- NEW FILE fix-anchors.patch ---
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);
 }
 


Index: gtk2.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gtk2/devel/gtk2.spec,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -p -r1.405 -r1.406
--- gtk2.spec	23 Sep 2009 05:33:38 -0000	1.405
+++ gtk2.spec	27 Sep 2009 04:27:04 -0000	1.406
@@ -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 document
 %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 at redhat.com> - 2.18.0-2
+- Fix anchor handling in text views (#525910)
+
 * Wed Sep 23 2009 Matthias Clasen <mclasen at redhat.com> - 2.18.0-1
 - Update to 2.18.0
 - Add some patches for improved printing support




More information about the fedora-extras-commits mailing list