GNOME Bugzilla – Bug 352063
cannot Glib::wrap a PangoLayout*
Last modified: 2006-09-29 07:31:36 UTC
Steps to reproduce: compile and run this minimal program: #include <glibmm/ustring.h> #include <glibmm/refptr.h> #include <cairomm/surface.h> #include <cairomm/context.h> #include <pangomm/layout.h> int main (int argc, char** argv) { Cairo::RefPtr<Cairo::PdfSurface> _csfc; Cairo::RefPtr<Cairo::Context> _cctx; Glib::RefPtr<Pango::Layout> _play; _csfc = Cairo::PdfSurface::create ("foo.pdf", 700, 1000); _cctx = Cairo::Context::create (_csfc); _play = Pango::Layout::create (_cctx); _play->set_width (1); } /* these are fantasy numbers */ Stack trace: ==4156== Memcheck, a memory error detector. ==4156== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. ==4156== Using LibVEX rev 1575, a library for dynamic binary translation. ==4156== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP. ==4156== Using valgrind-3.1.1, a dynamic binary instrumentation framework. ==4156== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al. ==4156== For more details, rerun with: -v ==4156== (process:4156): glibmm-CRITICAL **: Glib::ObjectBase*<unnamed>::create_new_wrapper(GObject*): assertion `wrap_func_table != 0' failed (process:4156): glibmm-WARNING **: failed to wrap type of 'PangoLayout' ==4156== Invalid read of size 4 ==4156== at 0x470BECC: Pango::Layout::set_width(int) (in /usr/lib/libpangomm-1.4.so.1.0.30) ==4156== by 0x8048C46: main (in /home/rws/calo/a.out) ==4156== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==4156== ==4156== Process terminating with default action of signal 11 (SIGSEGV) ==4156== Access not within mapped region at address 0x0 ==4156== at 0x470BECC: Pango::Layout::set_width(int) (in /usr/lib/libpangomm-1.4.so.1.0.30) ==4156== by 0x8048C46: main (in /home/rws/calo/a.out) ==4156== Other information: the pointer returned from pango_cairo_create_layout is non-NULL
You probably need to initialize pangomm. You can do that by using a gtkmm Main object.
Please respond. Does this fix your problem?
sorry for the late reply. Yes, adding a line with Gtk::Main fixes the problem.