[cairo] Trouble with cairomm Context::show_text

Jonathon Jongsma jonathon at quotidian.org
Mon Jul 21 11:43:44 PDT 2008


On Sun, Jul 20, 2008 at 5:14 PM, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> Hello list,
>
> I'm having trouble with cariomm and the show_text function. I'm new to
> the API and am probably doing something incredibly wrong, if anyone
> could give me a hint... Here it goes:
>
> std::string text = "mookoo";
> std::string fontname = "Sans";
> Cairo::TextExtents Extents;
> cr->set_font_size(30);
> cr->select_font_face(fontname, Cairo::FONT_SLANT_NORMAL,
> Cairo::FONT_WEIGHT_NORMAL);
> cr->get_text_extents(text, Extents);
> cr->move_to(X, Y);
> cr->show_text(text);
>
> At the show_text call, my application terminates:
>
> glibmm-ERROR **:
> unhandled exception (type std::exception) in signal handler:
> what: St9bad_alloc
>
> with a (probably not very meaningful, I might be wrong) stacktrace:
>
> #0  0x00002b3d9b95a3c5 in raise () from /lib/libc.so.6
> #1  0x00002b3d9b95b73e in abort () from /lib/libc.so.6
> #2  0x00002b3d9a592b55 in g_logv () from /usr/lib/libglib-2.0.so.0
> #3  0x00002b3d9a592bd8 in g_log () from /usr/lib/libglib-2.0.so.0
> #4  0x00002b3d98d6a53b in Glib::exception_handlers_invoke () from
> /usr/lib/libglibmm-2.4.so.1
> #5  0x00002b3d98d693e7 in Glib::DispatchNotifier::pipe_io_handler ()
> from /usr/lib/libglibmm-2.4.so.1
> #6  0x00002b3d98d69667 in
> sigc::internal::slot_call1<sigc::bound_mem_functor1<bool,
> Glib::DispatchNotifier, Glib::IOCondition>, bool,
> Glib::IOCondition>::call_it ()
>    from /usr/lib/libglibmm-2.4.so.1
> #7  0x00002b3d98d6baf2 in Glib::IOSource::dispatch () from
> /usr/lib/libglibmm-2.4.so.1
> #8  0x00002b3d98d6b0cf in Glib::Source::dispatch_vfunc () from
> /usr/lib/libglibmm-2.4.so.1
> #9  0x00002b3d9a58aa61 in g_main_context_dispatch () from
> /usr/lib/libglib-2.0.so.0
> #10 0x00002b3d9a58d834 in ?? () from /usr/lib/libglib-2.0.so.0
> #11 0x00002b3d9a58db24 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
> #12 0x00002b3d98497bef in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> #13 0x00002b3d97dc0439 in Gtk::Main::run () from /usr/lib/libgtkmm-2.4.so.1
> #14 0x0000000000408988 in BaseGUI::Startup (this=<value optimized out>,
> WindowName=@0x7fff13183e30) at BaseGUI.cpp:25
> #15 0x0000000000406712 in Actual_main (argc=1, argv=0x7fff13183f88) at
> gnuDMM.cpp:50
> #16 0x0000000000407596 in Protected_main (argc=16428, argv=0x402c) at
> gnuDMM.cpp:208
> #17 0x00002b3d9b947b74 in __libc_start_main () from /lib/libc.so.6
> #18 0x0000000000405d49 in _start ()
>
> I haven't found out yet how to avoid that Gtk catches the exception, so
> I can debug it myself. Does anyone know help anyways?
>
> Thanks in advance,
> Johannes
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>

I'm afraid I can't reproduce the problem with a simple test case.
Perhaps if you can try to reduce your example to a *minimal*
compilable test case that still exhibits the problem, we can
investigate. Note that you have to be careful to always catch
exceptions that might be thrown in a signal handler, because
exceptions can't be passed through C code.

-- 
jonner


More information about the cairo mailing list