Crashes with long words in strings passed to gtk_widget_set_tooltip_text()



The attached example program (by Colin Leroy) passes a string
with a long "word" to gtk_widget_set_tooltip_text() which causes
a crash when the tooltip is supposed to be shown.

(gdb) r --sync
Starting program: /home/fk/kram/tooltip-crashes/long_tooltip_crash --sync
[New LWP 101212]
[New Thread 805407400 (LWP 101212/initial thread)]

(long_tooltip_crash:65109): Gdk-WARNING **: Native Windows wider or taller than 65535 pixels are not supported

Gdk-ERROR **: The program 'long_tooltip_crash' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 725 error_code 11 request_code 53 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 805407400 (LWP 101212/initial thread)]
0x0000000803e77d5c in thr_kill () from /lib/libc.so.7
(gdb) where
#0  0x0000000803e77d5c in thr_kill () from /lib/libc.so.7
#1  0x0000000803f16b73 in abort () from /lib/libc.so.7
#2  0x0000000803a4fc1a in g_logv (log_domain=0x801059b3a "Gdk", log_level=G_LOG_LEVEL_ERROR, format=0x801059dbe "%s", args1=0x7fffffffc2f0) at gmessages.c:557
#3  0x0000000803a4fdbb in g_log (log_domain=0x801059b3a "Gdk", log_level=G_LOG_LEVEL_ERROR, format=0x801059dbe "%s") at gmessages.c:577
#4  0x0000000801019b1f in gdk_x_error (display=0x805504800, error=0x7fffffffc4a0) at gdkmain-x11.c:466
#5  0x00000008029d1054 in _XError (dpy=0x805504800, rep=0x80569f8e0) at XlibInt.c:3105
#6  0x00000008029d9f40 in handle_error (dpy=0x805504800, err=0x80569f8e0, in_XReply=1) at xcb_io.c:166
#7  0x00000008029da30d in handle_response (dpy=0x805504800, response=0x80569f8e0, in_XReply=1) at xcb_io.c:265
#8  0x00000008029dae39 in _XReply (dpy=0x805504800, rep=0x7fffffffc6b0, extra=0, discard=1) at xcb_io.c:554
#9  0x00000008029c8b70 in XSync (dpy=0x805504800, discard=0) at Sync.c:46
#10 0x00000008029c8c5e in _XSyncFunction (dpy=0x18b5c) at Synchro.c:35
#11 0x00000008029ce5e6 in _XPrivSyncFunction (dpy=0x805504800) at XlibInt.c:603
#12 0x000000080299a983 in XCreatePixmap (dpy=0x805504800, d=48234537, width=65535, height=23, depth=24) at CrPixmap.c:58
#13 0x000000080101a940 in _gdk_pixmap_new (drawable=0x8054c6480, width=65535, height=23, depth=24) at gdkpixmap-x11.c:175
#14 0x0000000800fcaa95 in IA__gdk_pixmap_new (drawable=0x8054c6480, width=65535, height=23, depth=-1) at gdkpixmap.c:249
#15 0x0000000800fdd59a in gdk_window_begin_implicit_paint (window=0x8054c6480, rect=0x7fffffffc8e0) at gdkwindow.c:2773
#16 0x0000000800fe2caa in gdk_window_process_updates_internal (window=0x8054c6480) at gdkwindow.c:5569
#17 0x0000000800fe30aa in IA__gdk_window_process_updates (window=0x8054c6480, update_children=1) at gdkwindow.c:5757
#18 0x0000000800b934f8 in gtk_window_move_resize (window=0x8054c8280) at gtkwindow.c:6246
#19 0x0000000800b92172 in gtk_window_check_resize (container=0x8054c8280) at gtkwindow.c:5408
#20 0x00000008036c21a9 in g_cclosure_marshal_VOID__VOID (closure=0x8056de5a0, return_value=0x0, n_param_values=1, param_values=0x80544aa00, invocation_hint=0x7fffffffceb0, 
    marshal_data=0x800b92130) at gmarshal.c:79
#21 0x00000008036a6ab2 in g_type_class_meta_marshal (closure=0x8056de5a0, return_value=0x0, n_param_values=1, param_values=0x80544aa00, invocation_hint=0x7fffffffceb0, marshal_data=0x2e0)
    at gclosure.c:877
#22 0x00000008036a6766 in g_closure_invoke (closure=0x8056de5a0, return_value=0x0, n_param_values=1, param_values=0x80544aa00, invocation_hint=0x7fffffffceb0) at gclosure.c:766
#23 0x00000008036c17a6 in signal_emit_unlocked_R (node=0x805478f60, detail=0, instance=0x8054c8280, emission_return=0x0, instance_and_params=0x80544aa00) at gsignal.c:3290
#24 0x00000008036c02b2 in g_signal_emit_valist (instance=0x8054c8280, signal_id=82, detail=0, var_args=0x7fffffffd230) at gsignal.c:2983
#25 0x00000008036c0899 in g_signal_emit (instance=0x8054c8280, signal_id=82, detail=0) at gsignal.c:3040
#26 0x00000008009350ae in IA__gtk_container_check_resize (container=0x8054c8280) at gtkcontainer.c:1431
#27 0x0000000800934d74 in gtk_container_idle_sizer (data=0x0) at gtkcontainer.c:1356
#28 0x0000000800fb2d58 in gdk_threads_dispatch (data=0x80544ac20) at gdk.c:512
#29 0x0000000803a4834b in g_idle_dispatch (source=0x805699ac0, callback=0x800fb2d00 <gdk_threads_dispatch>, user_data=0x80544ac20) at gmain.c:4254
#30 0x0000000803a43d9d in g_main_dispatch (context=0x80547a500) at gmain.c:2149
#31 0x0000000803a455d5 in g_main_context_dispatch (context=0x80547a500) at gmain.c:2702
#32 0x0000000803a45ba6 in g_main_context_iterate (context=0x80547a500, block=1, dispatch=1, self=0x805417500) at gmain.c:2780
#33 0x0000000803a46443 in g_main_loop_run (loop=0x8056a31a0) at gmain.c:2988
#34 0x00000008009e516c in IA__gtk_main () at gtkmain.c:1237
#35 0x0000000000400ee5 in main ()

I'm using GTK+ 2.22.1.

From the documentation at:
http://developer.gimp.org/api/2.0/gtk/GtkWidget.html#gtk-widget-set-tooltip-text
the expected behaviour isn't clear to me.

Is the crash a bug, or are applications supposed to somehow
verify that the tooltip text can't reach the limit mentioned
in the warning (or any other limits)?

Thanks
Fabian
/* Compile with
gcc \
	`pkg-config --cflags gtk+-2.0 glib-2.0` \
	`pkg-config --libs gtk+-2.0 glib-2.0` \
	-o long_tooltip_crash \
	long_tooltip_crash.c
*/
#include <gtk/gtk.h>

on_destroy (GtkWidget * widget, gpointer data)
{
	gtk_main_quit ();
}

int main(int argc, char *argv[])
{
	GtkWidget *window;
	GtkWidget *btn;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

	gtk_container_set_border_width (GTK_CONTAINER (window), 20);

	gtk_window_set_title (GTK_WINDOW (window), "Long tooltip crash");

	gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);

        
	g_signal_connect (G_OBJECT (window), "destroy",
        	      G_CALLBACK (on_destroy), NULL);

	btn = gtk_button_new_with_label("Hover me to crash");
        
        gtk_widget_set_tooltip_text(GTK_WIDGET(btn), "0________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4
_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________0_________1_________2_________3_________4_________5_________6_________7_________8_________9_________");
        
	gtk_container_add (GTK_CONTAINER (window), btn);

	gtk_widget_show_all (window);

	gtk_main ();

	return 0;
}

Attachment: signature.asc
Description: PGP signature



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