gtk_widget_area - expose_event - problem



Hi,

I got from GDB this error for my application:

Program received signal SIGSEGV, Segmentation fault.
0x0804b349 in expose_event (widget=0x80ac738, event=0x0, g=0x0)
    at graph_edit.c:248
248       gdk_draw_drawable (widget->window,
(gdb)

In this app, there are 2 timelines for graphic application
(ripped and modified from Eric Harlow source code chapter12/sysmon).
I have defined:

typedef struct {
    GdkDrawable *pixmap;
    GdkGC *gc;
} typGraphics;

extern GtkWidget *timeline_area1;
extern GtkWidget *timeline_area2;

static typGraphics *g1;
static typGraphics *g2;
.......
.......

    /* --- Create the drawing area  --- */
    timeline_area1 = gtk_drawing_area_new ();
    timeline_area2 = gtk_drawing_area_new ();

    /* --- Size --- */
    gtk_drawing_area_size (GTK_DRAWING_AREA (timeline_area1), 200, 200);
    gtk_drawing_area_size (GTK_DRAWING_AREA (timeline_area2), 200, 200);

    /* --- Make it visible --- */
    gtk_widget_show (timeline_area1);
	gtk_widget_show (timeline_area2);

    /* --- We need the expose_event and the configure_event --- */
    gtk_signal_connect (GTK_OBJECT (timeline_area1), "expose_event",
                (GtkSignalFunc) expose_event, g1);
    gtk_signal_connect (GTK_OBJECT(timeline_area1),"configure_event",
                (GtkSignalFunc) configure_event, (gpointer) g1);
    gtk_signal_connect (GTK_OBJECT (timeline_area2), "expose_event",
                (GtkSignalFunc) expose_event, g2);
    gtk_signal_connect (GTK_OBJECT(timeline_area2),"configure_event",
                (GtkSignalFunc) configure_event, (gpointer) g2);

and for "configure_event":

static gint expose_event (GtkWidget *widget, GdkEventExpose *event, typGraphics
*g)
{
  /* --- Copy it right over. --- */
  gdk_draw_drawable (widget->window,
          widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
          g->pixmap,
          event->area.x, event->area.y,
          event->area.x, event->area.y,
          event->area.width, event->area.height);



  return FALSE;
}

Maybe problem is for 'typGraphics *g' in expose_Event(..) but for generic
'gpointer g' I have not solution...

Thanks in advance
France


__________________________________________________________________
Tiscali ADSL SENZA CANONE:
Attivazione GRATIS, contributo adesione GRATIS, modem GRATIS,
50 ore di navigazione GRATIS.  ABBONARTI TI COSTA SOLO UN CLICK!
http://point.tiscali.it/adsl/index.shtml






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