]> Pileus Git - ~andy/gtk/commitdiff
Add warnings if you try to use a child anchor that isn't inside a buffer.
authorHavoc Pennington <hp@redhat.com>
Wed, 6 Feb 2002 22:07:47 +0000 (22:07 +0000)
committerHavoc Pennington <hp@src.gnome.org>
Wed, 6 Feb 2002 22:07:47 +0000 (22:07 +0000)
2002-02-06  Havoc Pennington  <hp@redhat.com>

* gtk/gtktextchild.c: Add warnings if you try to use a child
anchor that isn't inside a buffer. Really kind of lame;
we should separate the anchor from the buffer. But not worth
fixing for now. #70601

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextchild.c

index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index 7416948f74339618702112f75eaddd44596c54e6..ca832684f599bd432f13317e95f2f3ac846b482f 100644 (file)
@@ -1,3 +1,10 @@
+2002-02-06  Havoc Pennington  <hp@redhat.com>
+
+       * gtk/gtktextchild.c: Add warnings if you try to use a child
+       anchor that isn't inside a buffer. Really kind of lame; 
+       we should separate the anchor from the buffer. But not worth 
+       fixing for now. #70601
+
 Wed Feb  6 18:25:24 2002  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreemodelsort.c: rip out all the debugging ifdefs, as
index f22f10a79d1e38e2d3f24db4d92c5e5b33f4d4ae..d340c71d2d2cdd4edf6639f00e7bd789d0be1147 100644 (file)
@@ -52,6 +52,9 @@
 #include "gtktextbtree.h"
 #include "gtktextlayout.h"
 
+#define CHECK_IN_BUFFER(anchor) do { if ((anchor)->segment == NULL) g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", __FUNCTION__); } while (0)
+#define CHECK_IN_BUFFER_RETURN(anchor, val) do { if ((anchor)->segment == NULL) g_warning ("%s: GtkTextChildAnchor hasn't been in a buffer yet", __FUNCTION__); return (val); } while (0)
+
 static GtkTextLineSegment *
 pixbuf_segment_cleanup_func (GtkTextLineSegment *seg,
                              GtkTextLine        *line)
@@ -402,6 +405,8 @@ gtk_text_child_anchor_get_widgets (GtkTextChildAnchor *anchor)
   GList *list = NULL;
   GSList *iter;
 
+  CHECK_IN_BUFFER_RETURN (anchor, NULL);
+  
   g_return_val_if_fail (seg->type = &gtk_text_child_type, NULL);
 
   iter = seg->body.child.widgets;
@@ -436,6 +441,8 @@ gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor)
 {
   GtkTextLineSegment *seg = anchor->segment;
 
+  CHECK_IN_BUFFER_RETURN (anchor, TRUE);
+  
   g_return_val_if_fail (seg->type = &gtk_text_child_type, TRUE);
 
   return seg->body.child.tree == NULL;
@@ -449,6 +456,8 @@ gtk_text_child_anchor_register_child (GtkTextChildAnchor *anchor,
   g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
   g_return_if_fail (GTK_IS_WIDGET (child));
 
+  CHECK_IN_BUFFER (anchor);
+  
   _gtk_anchored_child_set_layout (child, layout);
   
   _gtk_widget_segment_add (anchor->segment, child);
@@ -463,6 +472,8 @@ gtk_text_child_anchor_unregister_child (GtkTextChildAnchor *anchor,
   g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
   g_return_if_fail (GTK_IS_WIDGET (child));
 
+  CHECK_IN_BUFFER (anchor);
+  
   if (_gtk_anchored_child_get_layout (child))
     {
       gtk_text_child_anchor_queue_resize (anchor,
@@ -484,6 +495,8 @@ gtk_text_child_anchor_queue_resize (GtkTextChildAnchor *anchor,
   
   g_return_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor));
   g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
+
+  CHECK_IN_BUFFER (anchor);
   
   seg = anchor->segment;