Problem with GdkPixbuf
- From: dashikugua 126 com
- To: "gtk-list" <gtk-list gnome org>
- Subject: Problem with GdkPixbuf
- Date: Thu, 5 Jul 2007 11:22:29 +0800 (CST)
Hi all:
I'm using the Gtkimage and GdkPixbuf to show picture and each time I run the program I get the following error:
GLib-Gobject-CRITICAL ** : g_object_unref : assertion `G_IS_OBJECT(object)` failed
I'm running GTK 2.6.4 and Glib 2.6.4 on a Debian woody.Here is the code which reproduces the problem:
#include <gtk/gtk.h>
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *image;
GdkPixbuf *pix1;
GdkPixbuf *pix2;
gtk_init(&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
image = gtk_image_new_from_file ("1.png");
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_container_add (GTK_CONTAINER (window), image);
pix1=gtk_image_get_pixbuf(GTK_IMAGE(image));
pix2=gdk_pixbuf_scale_simple(pix1,320,160,GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(image),pix2);
g_object_unref(pix1);
g_object_unref(pix2);
gtk_widget_show (image);
gtk_widget_show (window);
gtk_main ();
return(0);
}
I have no idea how to resolve the problem.Any help will be most appreciated.Thanks.
百 万 玩 家 同 玩 的 乐 园,人 气 爆 发 的 梦 幻 西 游
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]