Thank you very much!! I'm not sure if i have to do this every time an expose event occurs.. I think that i just need on start of application.. But i test on start of application, i i don't have widget->allocation values, to make the resize..
Now, application crash after start, but i think that is because i make the unref of pixbuf, and in next expose event, fails (i think)... GdkPixbuf-CRITICAL **: gdk_pixbuf_scale_simple: assertion 'GDK_IS_PIXBUF (src)' failed GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed Gdk-CRITICAL **: IA__gdk_pixbuf_render_pixmap_and_mask_for_colormap: assertion 'GDK_IS_PIXBUF (pixbuf)' failed GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed Às 09:54 de 02/03/2017, Gabriele Greco escreveu: >> This works, but application blocks after a while.. >> > I'm quite sure the problem is that you are leaking at least 2 pixbuf and a > pixmap for every expose event your app receives, and anyway, are you sure > you have to do it every time an expose event is thrown and not only when > the window is resized (configure_event)? > > >> >> pixbuf = gdk_pixbuf_scale_simple(pixbuf, widget->allocation.width, >> > If the original pixbuf has been created just for this operation, this call > leaks a pixbuf object, you shoud do something like: > > GdkPixbuf *scaled = gdk_pixbuf_scale_simple(pixbuf, > widget->allocation.width, [...] > g_object_unref(pixbuf); > > >> widget->allocation.height, GDK_INTERP_BILINEAR); >> gdk_pixbuf_render_pixmap_and_mask (pixbuf, &background, NULL, 0); >> > At this point you leak the second pixbuf, use for instance: > g_object_unref(scaled); > > >> style->bg_pixmap[0] = background; >> gtk_widget_set_style (GTK_WIDGET(widget), GTK_STYLE(style)); >> > I'm quite sure set_style will increase reference count for 'background', so > after this call you should unref that pixmap: > > g_object_unref(background); > > You'll receive runtime errors if one of my statements here is not correct, > it's better to add a not needed unref in development and fix it that > release a version that leaks memory. > --- Este e-mail foi verificado em termos de vírus pelo software antivírus Avast. https://www.avast.com/antivirus _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list