Gdk::Pixbuf#from_drawable Memory Leak?

Hey,

I have been having problems with using Gdk::Pixbuf#from_drawable - it
seems to leak memory (see example below).

Is this a (known) bug? Is there a patch/workaround?

Regards,
Andy.

require ‘gtk2’
require ‘gtkmozembed’

Gtk.init

gtk = Gtk::Window.new

moz = Gtk::MozEmbed.new
moz.set_chrome_mask(Gtk::MozEmbed::ALLCHROME)

gtk.add(moz)
gtk.maximize
gtk.show_all

moz.load_url(“http://www.google.com/”)

Gtk::timeout_add(1000) do
x, y, width, height, depth = gtk.window.geometry

    pixbuf = Gdk::Pixbuf.from_drawable(nil, gtk.window, 0, 0, width,

height)
pixbuf = pixbuf.scale(640, 400, Gdk::Pixbuf::INTERP_BILINEAR)
pixbuf.save(“foo.png”, “png”)

    GC.start # This doesn't help :(

    true

end

Gtk.main


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Gdk::Pixbuf#from_drawable Memory Leak?” on
Sat, 14 Oct 2006 03:44:04 +0100,
Andy C. [email protected] wrote:

I have been having problems with using Gdk::Pixbuf#from_drawable - it
seems to leak memory (see example below).

Thanks for reporting a bug. I fixed in CVS.

Is this a (known) bug? Is there a patch/workaround?

Try the attached patch.

Thanks,

Hey,

Many thanks - your patch has fixed it. :slight_smile:

Regards,
Andy.

Kouhei S. wrote:

Try the attached patch.
RCS file: /cvsroot/ruby-gnome2/ruby-gnome2/gtk/src/rbgdkpixbuf.c,v

  •        g_object_unref(buf);
    

Get stuff done quickly with pre-integrated technology to make your job easier


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs