segfault in find_native_sibling_above_helper from gtk+2.18.6



Hello,
i compiled gtk+2.18.6 for use with directfb on an arm target.

When i run the following code i get a segmentation fault in function ( gtk_widget_show_all(window); )

find_native_sibling_above_helper(GdkWindowObject *parent,
                  GdkWindowObject *child)

in file gdk/gdkwindow.c line 1123.

The parent argument is 0x0.

This is the testapplication:


#include <cairo.h>
#include <gtk/gtk.h>
#include <time.h>


static char buffer[256];


static gboolean
on_expose_event(GtkWidget *widget,
    GdkEventExpose *event,
    gpointer data)
{
  cairo_t *cr;

  cr = gdk_cairo_create(widget->window);

  cairo_move_to(cr, 30, 30);
  cairo_show_text(cr, buffer);

  cairo_destroy(cr);

  return FALSE;
}

static gboolean
time_handler(GtkWidget *widget)
{
  if (widget->window == NULL) return FALSE;

  time_t curtime;
  struct tm *loctime;

  curtime = time(NULL);
  loctime = localtime(&curtime);
  strftime(buffer, 256, "%T", loctime);

  gtk_widget_queue_draw(widget);
  return TRUE;
}

int
main (int argc, char *argv[])
{

  GtkWidget *window;
  GtkWidget *darea;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

  darea = gtk_drawing_area_new();
  gtk_container_add(GTK_CONTAINER (window), darea);

  g_signal_connect(darea, "expose-event",
      G_CALLBACK(on_expose_event), NULL);
  g_signal_connect(window, "destroy",
      G_CALLBACK(gtk_main_quit), NULL);

  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 320, 240);

  gtk_window_set_title(GTK_WINDOW(window), "timer");
  g_timeout_add(1000, (GSourceFunc) time_handler, (gpointer) window);
  gtk_widget_show_all(window);
  time_handler(window);

  gtk_main();

  return 0;
}

It`s a tutorial linked on gtk.org

This are the versions of the stuff working together with gtk+:

DirectFB-1.4.0.tar.gz
atk-1.25.2.tar.gz
cairo-1.8.6.tar.gz
fontconfig-2.7.0.tar.gz
glib-2.22.4.tar.gz
gtk+-2.18.6.tar.gz
pango-1.26.2.tar.gz
pixman-0.15.16.tar.gz
tslib.tar.gz
liberation-fonts.tar.gz

Can anybody please tell whats going wrong?
Is ther a Bug in gtk_widget_show_all ?
Or are the version i used together are not compatible?

Any Ideas are very welcome,
thank you very much.

Regards,
Bastian.




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