[Kde-bindings] KDE/kdebindings/csharp/qyoto

Richard Dale rdale at foton.es
Thu May 31 09:06:35 UTC 2007


On Wednesday 30 May 2007, Arno Rehn wrote:
> Am Montag, 28. Mai 2007 schrieb Richard Dale:
> > SVN commit 669020 by rdale:
> >
> > * Further simplified the marshalling of primitive reference types. As
> >   a pointer the the value on the C# stack is copied to the smoke stack
> >   before the method call, the value after the method call doesn't need
> >   to be copied back.
> > * Added a marshaller for 'short&' and 'short*' arg types
>
> I think these changes have broken the custom signal handling, e.g. t14 now
> crashes with
>
>   at (wrapper managed-to-native) Qyoto.SmokeInvocation.CallSmokeMethod
> (int,intptr,intptr,int) <0x00004>
>   at (wrapper managed-to-native) Qyoto.SmokeInvocation.CallSmokeMethod
> (int,intptr,intptr,int) <0xffffffff>
>   at Qyoto.SmokeInvocation.Invoke (string,string,System.Type,object[])
> <0x00885>
>   at Qyoto.QWidget.Show () <0x00032>
>   at T14.Main (string[]) <0x0005e>
>   at (wrapper runtime-invoke) System.Object.runtime_invoke_void_string[]
> (object,intptr,intptr,intptr) <0xffffffff>
>
> Native stacktrace:
>
>         mono [0x8161fa4]
>         mono [0x812c544]
>         [0xb7eef440]
>         /usr/lib/libX11.so.6(XSetWMProperties+0xa0) [0xb5c043a0]
>         /usr/lib/qt4/libQtGui.so.4
> (_ZN19QApplicationPrivate36applyX11SpecificCommandLineArgumentsEP7QWidget+0
>xac) [0xb630f46c]
>         /usr/lib/qt4/libQtGui.so.4(_ZN7QWidget10setVisibleEb+0x508)
> [0xb6306608]
>         /usr/lib/libsmokeqt.so.2(_ZN9x_QWidget10setVisibleEb+0x68)
> [0xb6ea4b58]
>         /usr/lib/libsmokeqt.so.2
> (_Z13xcall_QWidgetsPvPN5Smoke9StackItemE+0x14a0) [0xb6e9b3b0]
>         ./libqyoto.so(_ZN10MethodCall10callMethodEv+0xe8) [0xb6fe63d2]
>         ./libqyoto.so(_ZN10MethodCall4nextEv+0x97) [0xb6fe65b1]
>         ./libqyoto.so(CallSmokeMethod+0x164) [0xb6fe0c36]
>         [0xb4fb0c76]
>         [0xb4fafbde]
>         [0xb4d8d9f3]
>         [0xb738e5ef]
>         [0xb738e063]
>         mono(mono_runtime_exec_main+0x62) [0x80dd302]
>         mono(mono_runtime_run_main+0x1b3) [0x80dd5f3]
>         mono(mono_main+0x109d) [0x805932d]
>         mono [0x8057d92]
>         /lib/libc.so.6(__libc_start_main+0xdc) [0xb7cd783c]
>         mono [0x8057ce1]
The problem is with the int& arg type in 'QApplication ( int & argc, char ** 
argv )', the marshaller used to allocate a new version of the argc arg to 
pass to the method:

        case Marshall::FromObject:
            {
            int * i = new int;
            *i = m->var().s_int;
            m->item().s_voidp = i;
            m->next();
            if(m->cleanup() && m->type().isConst()) {
                delete i;
            } else {
//                m->item().s_voidp = new int((int)NUM2INT(rv));
            }
            }
            break;

And now it doesn't:

	case Marshall::FromObject:
	{
		m->item().s_voidp = &(m->var().s_int);
	}
	break;

But I think the new marshaller is correct and we shouldn't introduce a memory 
leak for all 'int&' arg types just to fix this problem. The QApplication 
constructor 'int&' should be special cased, along with any others like it.

-- Richard




More information about the Kde-bindings mailing list