problem with gdk-pixbuf



Hi,

I have problem with gdk-pixbuf library when I migrating from Imlib
to gdk-pixbuf. My code of Imlib style:

------------------------------------------------------------------
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "nightview.xpm"

static GdkPixbuf *im = NULL;

gboolean expose_obr(GtkWidget *obr)
{
  
  gdk_pixbuf_render_to_drawable(im,obr->window,obr->style->white_gc,
                  0,0,0,0,265,265,GDK_RGB_DITHER_NORMAL, 0,0);  
    return(FALSE);
}
gboolean configure_obr(GtkWidget *obr)
{

  if( im ) 
    gdk_pixbuf_unref(im);

  im = gdk_pixbuf_new_from_xpm_data(m101);
  gdk_pixbuf_render_to_drawable(im, obr->window, obr->style->black_gc,
                                0,0,0,0,265,265,GDK_RGB_DITHER_NORMAL, 0,0);

  return(FALSE);
}

int main(int argc, char *argv[])
{
  GtkWidget *window, *obr; /* obr is image in czech */

  gtk_init(&argc,&argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_usize (window, 265, 265);

  obr = gtk_drawing_area_new();
  gtk_container_add(GTK_CONTAINER(window), obr);
  gtk_widget_show(obr);

  gtk_signal_connect(GTK_OBJECT(obr), "expose_event",
                     GTK_SIGNAL_FUNC(expose_obr), NULL);
  gtk_signal_connect(GTK_OBJECT(obr), "configure_event",
                     GTK_SIGNAL_FUNC(configure_obr), NULL);

  gtk_widget_show(window);
  gtk_main();

  return(0);
}
------------------------------------------------------------------

crashed on fault:

(gdb) run
Starting program: /tmp/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x401797b4 in gdk_draw_rgb_image_dithalign () from /usr/lib/libgdk-1.2.so.0
(gdb) 

The analogical code for imlib or pixmap works ok. 
I supposes that some of passing parameter is wrong??

The version of gdk-pixbuf is 0.11.0 and GTK 1.2.

Thanks for revealing of this secret

FH




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