[Mono-dev] SIGSEGV in Cairo.CairoAPI:cairo_get/set_matrix()
idan at fastmail.fm
Mon Oct 31 15:32:57 EST 2005
Ok, so attached is a patch covering the items I mention below.
I expect somebody more experienced with Mono.Cairo should look this
over, I expect I'll have to make some changes. *nudging Hisham/JLuke*...
Regarding the broken ref arguments, I filed:
in this regards.
Should I break this patch up into two pieces, one to fix the ref issue
and one for everything else?
Idan Gazit wrote:
> OK, So this email touches on Mono.Cairo in 3 parts:
> 1. SIGSEGV
> OK, I got some help from Michael Dominic, who pointed out that
> cairo_get_matrix (IntPtr cr, Matrix_T matrix);
> should really be:
> cairo_get_matrix (IntPtr cr, ref Matrix_T matrix);
> It seems that any CairoAPI function which takes a matrix should pass a
> ref Matrix_T and not a Matrix_T. This seems to include the following:
> I'm preparing a patch to this effect.
> 2. Class Or Struct?
> About this time, lewing (in #mono) suggested that there's no point for
> Matrix to be a class hiding a Matrix_T struct, rather make Matrix a
> struct. So I went ahead and did this, and I'm testing it now (looks OK).
> I don't know the reasons behind wrapping Matrix_T in a class, so can
> somebody tell me (not sarcastic) why? If there are advantages to having
> Matrix be a struct and doing away with Matrix_T then I have the patch
> ready to go.
> 3. Miscellaneous Design Improvements(?)
> Either way to go (struct or class), I saw a few places where changes
> seemed logical to me:
> - "Identify" should be "Identity"
> - Have Translate/Rotate/Scale et al return (this); so as to enable
> things like myMatrix.Translate().Rotate().Scale().
> - public static Matrix Identity property as an easy way of getting at
> the identity matrix.
> - No need for Pointer nor Raw properties in Matrix (they're not used
> - override Matrix.ToString () to produce something useful for debugging.
> At any rate, all of these together constitutes a patch to Cairo.cs,
> Graphics.cs, Matrix.cs, and Pattern.cs. I can make patches for each of
> the three individually, or whatever.
> Please let me know how to proceed, I'd be very happy to put in my first
> patch for mono. :)
> Idan Gazit wrote:
>> So I manage to segfault when playing with the Graphics.Matrix
>> property. Basically anything that would result in a call to
>> cairo_get_matrix or cairo_set_matrix segfaults.
>> The stacktrace for this segfault when doing get is below, but
>> triggering it is pretty easy:
>> // set up graphics here, then
>> the same for set:
>> Cairo.Matrix transformMatrix = new Cairo.Matrix ();
>> transformMatrix.CreateIdentify ();
>> // set up graphics here, then
>> g.Matrix = transformMatrix;
>> Should I be talking to the cairo devs aobut this, instead?
>> Got a SIGSEGV while executing native code. This usually indicates
>> a fatal error in the mono runtime or one of the native libraries
>> used by your application.
>> Native stacktrace:
>> in <0x4> (wrapper managed-to-native) Cairo.CairoAPI:cairo_get_matrix
>> in <0xffffffa1> (wrapper managed-to-native)
>> Cairo.CairoAPI:cairo_get_matrix (intptr,Cairo.Matrix_T)
>> in <0x49> Cairo.Graphics:get_Matrix ()
>> in [0xc1] Meshwork.NetworkMap.ZoomableCairoArea:OnExposeEvent
>> in [0x14] Gtk.Widget:exposeevent_cb (intptr,intptr)
>> in <0x49cce3> (wrapper native-to-managed) Gtk.Widget:exposeevent_cb
>> in <0x4> (wrapper managed-to-native) Gtk.Application:gtk_main ()
>> in <0xffffffe7> (wrapper managed-to-native) Gtk.Application:gtk_main ()
>> in [0x0] Gtk.Application:Run ()
>> in [0xb] MainClass:Main (string)
>> in <0x50bbe2f9> (wrapper runtime-invoke)
>> System.Object:runtime_invoke_void_string (object,intptr,intptr,intptr)
>> mono(mono_handle_native_sigsegv+0x73) [0x813d883]
>> mono [0x81108db]
>> /usr/lib/libcairo.so.2(cairo_get_matrix+0x1b) [0xb69343fb]
>> /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x11e) [0xb697b3a8]
>> /usr/lib/libgobject-2.0.so.0 [0xb6989c9f]
>> /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x41e) [0xb698aec3]
>> /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x29) [0xb698b4c3]
>> /usr/lib/libgtk-x11-2.0.so.0 [0xb6d4e16f]
>> /usr/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x4f7) [0xb6c6ad72]
>> /usr/lib/libgdk-x11-2.0.so.0 [0xb6ae6bfa]
>> /usr/lib/libgdk-x11-2.0.so.0 [0xb6ae6d4e]
>> /usr/lib/libglib-2.0.so.0 [0xb7f0d750]
>> /usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x1dc) [0xb7f0b4ee]
>> /usr/lib/libglib-2.0.so.0 [0xb7f0e4f6]
>> /usr/lib/libglib-2.0.so.0(g_main_loop_run+0x1a1) [0xb7f0e7e3]
>> /usr/lib/libgtk-x11-2.0.so.0(gtk_main+0xb4) [0xb6c69e65]
>> mono(mono_runtime_exec_main+0x52) [0x8090ae2]
>> mono(mono_runtime_run_main+0x12f) [0x80934ef]
>> mono(mono_main+0xeff) [0x805d26f]
>> /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xd2) [0xb7d7bea2]
>> mono [0x805be11]
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13274 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051031/b178c502/attachment.bin
More information about the Mono-devel-list