[gtkmm] Failed to wrap type of 'GdkPixbuf' ???
- From: Avery Scott <avery scott web de>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Failed to wrap type of 'GdkPixbuf' ???
- Date: Mon, 21 Jun 2004 15:42:50 +0200
Dear all,
I am using Gtkmm on a nearly daily basis and I learned to like it a lot.
However I experience problems with the behavior of the following code:
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/box.h>
#include <gtkmm/separator.h>
#include <gtkmm/button.h>
#include <gdkmm/pixbufloader.h>
#include <gtkmm/image.h>
class Window : public Gtk::Window
{
public:
Window(const unsigned char* img, size_t img_size) : Gtk::Window()
{
set_title("Image");
set_resizable(false);
Gtk::VBox* box = Gtk::manage(new class Gtk::VBox());
box->set_spacing(3);
box->set_border_width(1);
Glib::RefPtr<Gdk::PixbufLoader> image_loader =
Gdk::PixbufLoader::create();
image_loader->write(img, img_size);
image_loader->close();
Gtk::Image* image = Gtk::manage(new class
Gtk::Image(image_loader->get_pixbuf()));
Gtk::HSeparator* sep = Gtk::manage(new class Gtk::HSeparator());
Gtk::Button* btn = Gtk::manage(new class
Gtk::Button(Gtk::StockID("gtk-quit")));
box->pack_start(*image, Gtk::PACK_SHRINK, 0);
box->pack_start(*sep, Gtk::PACK_SHRINK, 0);
box->pack_start(*btn, Gtk::PACK_SHRINK, 0);
add(*box);
btn->signal_clicked().connect(SigC::slot(*this, &Gtk::Window::hide));
}
static void show_image(const unsigned char* img, size_t img_size)
{
Gtk::Main kit(0, NULL);
Window w(img, img_size);
w.show_all();
Gtk::Main::run(w);
}
};
The problem is that although everything compiles and runs fine for the
first time, I get the following error messages during a second call to
Window::show_image():
(<unknown>:25648): glibmm-CRITICAL **: file wrap.cc: line 51
(Glib::ObjectBase* <unnamed>::create_new_wrapper(GObject*)): assertion
`wrap_func_table != 0' failed
(<unknown>:25648): glibmm-WARNING **: failed to wrap type of 'GdkPixbuf'
Could someone on this list please tell me what I am doing wrong?
Thanks in advance,
Avery Scott.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]