Crash when calling Gdk::Drawable::draw_pixbuf



Hi,

I have a question belonging to a conversion from Gtk::Image to Gdk::Image.

First at all, I have created an UI via Glade that contains some
(Gtk::)Image widgets. Then I am loading an input image into one of those
widgets. I also have some nifty resizing buttons that read the
Gdk::Pixbuf from that image, scale(_simple) that and redisplay it on the
widget. Until here I have absolutely no problems, that works quite well.

But now I want to read in an (empty/white) image, draw a simple pixel to
position (x,y) and redisplay the modified image.

To achieve this, I am currently doing the following:
• have the following member variables (m_pixbuf, m_gc, m_dim are
initialized and work properly, m_drawable and m_gdk_image are NULL ):

Glib::RefPtr<Gdk::GC> m_gc;
Glib::RefPtr<Gdk::Drawable> m_drawable;
Glib::RefPtr<Gdk::Image> m_gdk_image;
Glib::RefPtr<Gdk::Pixbuf> m_pixbuf;
rdcnnsim::Dimension m_dim;

/* rdcnnsim::Dimension
 * simple class that contains width and height as integers
 */

• take the Gdk::Pixbuf of the Gtk::Image and call:

m_drawable->draw_pixbuf(m_gc,
		        m_pixbuf,
		        0,0,
			0,0,
			m_dim.get_width(),
			m_dim.get_height(),
			Gdk::RGB_DITHER_NONE,
			0,0);

At this point I am getting an extraordinary annoying segfault when
starting the application.

The next step would be (if I get that error away) to use the
Gdk::Drawable::get_image() member for creating an Gdk::Image.

Unfortunately I have no idea anymore where else to look, so I ask you
for some help. That whole thing is used for a student research project
and the submission date is getting closer every hour I spent with bug
searching.

Thanks in advance!

Greetings,
Falk Schilling


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