Re: Gtk::CellRendererPixbuf: unable to set property 'surface'

On 3 October 2017 at 23:13, Alexander Shaduri <ashaduri gmail com> wrote:
(although I'm not sure whether the "surface"
variable leaks? The docs don't mention):

cairo_surface_t* surface = gdk_cairo_surface_create_from_pixbuf(
        pixbuf->gobj(), get_scale_factor(), get_window()->gobj());
g_object_set(G_OBJECT(cell_renderer_pixbuf.gobj()), "surface", surface, NULL);

The create function returns an object with 1 reference, which you are responsible to destroy(). You pass it to GtkCellRendererPixbuf, whic passes the surface to gtk_image_definition_new_surface (cairo_surface_t *surface), which refs the surface. So you need to drop the reference you had after calling the latter, unless you want to keep the surface alive longer than the CellRenderer does.

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