Gtk.init
-#- Gdk::Pixbuf#rotate memory leak check (in ruby-gnome2 <= 0.16.0)
-#pb = Gdk::Pixbuf.new("#{$FPATH}/images/logo.png")
-#1.upto(5) { pb = pb.rotate(Gdk::Pixbuf::ROTATE_CLOCKWISE) }
-#GC.start
-#mem = get_mem
-#1.upto(5) { pb = pb.rotate(Gdk::Pixbuf::ROTATE_CLOCKWISE) }
-#GC.start
-#mem2 = get_mem
-#if mem2 != mem
-# puts _("Gdk::Pixbuf#scale memory leak detected (this is normal with unpatched ruby-gnome2 <= 0.16.0). Application would slow down to a crawl, won't proceed.")
-# exit 1
-#end
-
create_main_window
check_config
return self;
}
+static VALUE rotate_noleak(VALUE self, VALUE angle) {
+ VALUE ret;
+ GdkPixbuf* dest = gdk_pixbuf_rotate_simple(_SELF(self), RVAL2GENUM(angle, GDK_TYPE_PIXBUF_ROTATION));
+ if (dest == NULL)
+ return Qnil;
+ ret = GOBJ2RVAL(dest);
+ g_object_unref(dest);
+ return ret;
+}
void
Init_libadds()
RGObjClassInfo* cinfo = (RGObjClassInfo*)rbgobj_lookup_class_by_gtype(GDK_TYPE_PIXBUF, Qnil);
rb_define_method(cinfo->klass, "whitebalance!", whitebalance, 1);
rb_define_method(cinfo->klass, "gammacorrect!", gammacorrect, 1);
+ rb_define_method(cinfo->klass, "rotate", rotate_noleak, 1);
cinfo = (RGObjClassInfo*)rbgobj_lookup_class_by_gtype(GDK_TYPE_DRAWABLE, Qnil);
rb_define_method(cinfo->klass, "draw_borders", draw_borders, 5);