Segfault with GnomeCanvasWidget, test case
- From: Aaron Lehmann <aaronl vitelus com>
- To: gnome-devel-list gnome org
- Subject: Segfault with GnomeCanvasWidget, test case
- Date: Sat, 22 Jan 2000 18:50:44 +0000 (GMT)
Hi,
GnomeCanvasWidget has not been working for be at all. I have tried many
things but it always either segfaults or doesn't display anything. I have
attatched a simple program (compilation instructions in header) that
produces a segfault when run on my machine. Can anyone fix it or
gnome-libs so it doesn't segfault?
Bonus: If you can get it to stop segfaulting, can you get it to actually
display the label?
Thanks,
Aaron Lehmann
/* Compile me with: cc -g `gnome-config --libs gnomeui` `gnome-config --cflags gnomeui` -o badcanvas badcanvas.c */
#include <gnome.h>
int
main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *scrolledwindow1;
GtkWidget *canvas1;
GtkWidget *widget;
GnomeCanvasItem* item;
GnomeCanvasGroup * group;
gnome_init ("badcanvas", "0.0.0", argc, argv);
gdk_rgb_init ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize (window, 400, 400);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow1);
gtk_container_add (GTK_CONTAINER(window), scrolledwindow1);
gtk_widget_push_visual(gdk_rgb_get_visual());
gtk_widget_push_colormap(gdk_rgb_get_cmap());
canvas1 = gnome_canvas_new();
gtk_widget_pop_colormap();
gtk_widget_pop_visual();
gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas1), 0, 0, 600, 600);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), canvas1);
group = gnome_canvas_root(GNOME_CANVAS(canvas1));
widget = gtk_label_new ("This is a canvas-widget with a label");
item = gnome_canvas_item_new (group,
gnome_canvas_widget_get_type(),
"widget", widget,
"x", 0,
"y", 40,
"anchor", GTK_ANCHOR_NORTH_WEST,
"width", 500,
"height", 500,
"size_pixels", TRUE,
NULL);
item = gnome_canvas_item_new (group,
gnome_canvas_text_get_type(),
"text", "This is a text item",
"anchor", GTK_ANCHOR_NORTH_WEST,
"font", "fixed",
NULL);
gtk_widget_show (widget);
gtk_widget_show (canvas1);
gtk_widget_show (scrolledwindow1);
gtk_widget_show (window);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]