Copiando
You can copy RefPtrs, just like normal pointers. But unlike normal pointers, you don't need to worry about deleting the underlying instance.
auto refPixbuf = Gdk::Pixbuf::create_from_file(filename); auto refPixbuf2 = refPixbuf;
Of course this means that you can store RefPtrs in standard containers, such as std::vector or std::list.
std::list<Glib::RefPtr<Gdk::Pixbuf>> listPixbufs; auto refPixbuf = Gdk::Pixbuf::create_from_file(filename); listPixbufs.push_back(refPixbuf);