After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 352063 - cannot Glib::wrap a PangoLayout*
cannot Glib::wrap a PangoLayout*
Status: RESOLVED INVALID
Product: glibmm
Classification: Bindings
Component: object
2.11.x
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2006-08-19 18:49 UTC by Ralf Stephan
Modified: 2006-09-29 07:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ralf Stephan 2006-08-19 18:49:33 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
Comment 1 Murray Cumming 2006-09-19 20:19:57 UTC
You probably need to initialize pangomm. You can do that by using a gtkmm Main object.
Comment 2 Murray Cumming 2006-09-28 16:02:12 UTC
Please respond. Does this fix your problem?
Comment 3 Ralf Stephan 2006-09-29 07:31:36 UTC
sorry for the late reply. Yes, adding a line with Gtk::Main fixes the problem.