[Gambas-user] Segfault when overriding Variant[]

Benoît Minisini gambas at ...1...
Tue May 1 12:23:53 CEST 2012


Le 01/05/2012 10:47, tobi a écrit :
> On Tue, 01 May 2012, tobi wrote:
>> Hi,
>>
>> I promptly get a segfault when I try to create an instance of my extended Variant[]:
>>
>> .src/Variant[].class
>> --8<---------
>> ' Gambas class file
>>
>> Export
>>
>> Public Sub _compare(hV As Variant[]) As Integer
>>    Return 0
>> End
>> --8<---------
>>
>> .src/MMain.module
>> --8<---------
>> ' Gambas module file
>>
>> Public Sub Main()
>>    Dim hV As New Variant[]
>> End
>> --8<---------
>>
>> I hope that it's possible to override native classes?
>>
>> Regards,
>> Tobi
>
> Oh, I should look first and then post...
> Segfault comes from
> gbx_class.c:1358:
> 	array_type->array_class = class;
> but before that in the same function:
> 	CLASS *array_type = (CLASS *)class->array_type;
> and look at:
> (gdb) print class->array_type
> $2 = 12
>
> which is GB_T_VARIANT, as supposed to be since I exported a Variant[].
> I think creating that as a pointer is a bug. (Creating arrays of native datatypes not expected?)
>
> The article about Gambas object model says that gb.qt Application extends gb Application so, I am
> allowed to extend native classes!
>
> Regards,
> Tobi
>

Hu hu. It should be possible to override any class, but please provide a 
project so that I can debug!

-- 
Benoît Minisini




More information about the User mailing list