Text_view, scrolled windows and no wrapping of words



Hello,

  --- sorry for the previous message if it went through, wrong heading :-(--

  Here is part of my code:
--------------------------------------------------
    SG_buffer = gtk_text_buffer_new(NULL);
    SG_text_view = gtk_text_view_new_with_buffer(SG_buffer);
    gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(SG_text_view), GTK_WRAP_NONE);
    SG_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
    gtk_container_add(GTK_CONTAINER(SG_scrolled_window), SG_text_view);
--------------------------------------------------
and I write on it with
--------------------------------------------------
void Sol_print_infos(gchar *letexte)
{
    GtkTextIter maxIter; /* la position format Iter
                                        de point-max dans SGinfosbuffer */
    /*STOP;printf(letexte);STOP;*/
    GTK_FLUSH;
    gtk_text_buffer_get_end_iter (SG_buffer, &maxIter);
    gtk_text_buffer_place_cursor (SG_buffer, &maxIter);
    gtk_text_buffer_insert_at_cursor (SG_buffer, letexte, -1);
    gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW(SG_text_view),
                                  gtk_text_buffer_get_insert (SG_buffer),
                                  0.0, FALSE, 0.0, 0.0);
    GTK_FLUSH;
}
--------------------------------------------------
I get segfaut when (1) the window has been scrolled horizontally
                   (2) and I try to Sol_print_infos("done.\n")
The first or the second time It occurs (more often the second time).

This last call is even wrapped so that the string "done.\n"
is indeed a pointer newly allocated with g_snprintf.
Here is an extract of gdb output
(the --sync has been sent to gtk_init):
-----------SegFault the first time-----------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1082429440 (LWP 6149)]
0x40578a0e in malloc_consolidate () from /lib/tls/libc.so.6
(gdb) where
#0  0x40578a0e in malloc_consolidate () from /lib/tls/libc.so.6
#1  0x000000a0 in ?? ()
#2  0x4062c7c8 in main_arena () from /lib/tls/libc.so.6
#3  0x0824c088 in ?? ()
#4  0x4062c7b4 in main_arena () from /lib/tls/libc.so.6
#5  0x4062c7a0 in main_arena () from /lib/tls/libc.so.6
#6  0x4062c780 in __malloc_initialize_hook () from /lib/tls/libc.so.6
#7  0x4062aff4 in ?? () from /lib/tls/libc.so.6
#8  0x4062c780 in __malloc_initialize_hook () from /lib/tls/libc.so.6
#9  0x08227ae0 in ?? ()
#10 0xbfffd89c in ?? ()
#11 0x4057a41e in _int_malloc () from /lib/tls/libc.so.6
Previous frame inner to this frame (corrupt stack?)
----------SegFault the second time--------------------------------
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1082429440 (LWP 6105)]
0x40579ab9 in _int_free () from /lib/tls/libc.so.6
(gdb) where
#0  0x40579ab9 in _int_free () from /lib/tls/libc.so.6
#1  0x40579f0b in free () from /lib/tls/libc.so.6
#2  0x404c5122 in IA__g_free (mem=0x824f2a8) at gmem.c:187
#3  0x4043e340 in pango_glyph_string_free () from /opt/gnome/lib/libpango-1.0.so.0
#4  0x40447885 in free_run () from /opt/gnome/lib/libpango-1.0.so.0
#5  0x404478fc in pango_layout_line_unref () from /opt/gnome/lib/libpango-1.0.so.0
#6  0x40447e73 in pango_layout_clear_lines () from /opt/gnome/lib/libpango-1.0.so.0
#7  0x4044bfed in pango_layout_finalize () from /opt/gnome/lib/libpango-1.0.so.0
#8  0x4046ee4e in IA__g_object_unref (_object=0x822b978) at gobject.c:571
#9 0x4025b948 in gtk_text_layout_free_line_display () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #10 0x4025b9b7 in gtk_text_layout_invalidate_cache () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #11 0x40260ca5 in gtk_text_layout_real_invalidate () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #12 0x4025b4bf in gtk_text_layout_invalidate () from /opt/gnome/lib/libgtk-x11-2.0.so.0 #13 0x40245486 in _gtk_text_btree_invalidate_region () from /opt/gnome/lib/libgtk-x11-2.0.so.0
#14 0x40245525 in redisplay_mark () from /opt/gnome/lib/libgtk-x11-2.0.so.0
#15 0xbfffdd40 in ?? ()
#16 0xbfffdd00 in ?? ()
#17 0x4025334e in iter_set_from_byte_offset () from /opt/gnome/lib/libgtk-x11-2.0.so.0
Previous frame inner to this frame (corrupt stack?)
----------------------------------------------------------------------
which is extremely severe (lots more calls should be given, but
everything seems to be corrupted).
If I replace GTK_WRAP_NONE with GTK_WRAP_CHAR or GTK_WRAP_WORD,
all is fine.
Any help would be greatly appreciated!
Best,
Amities,
         Olivier




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