[Gambas-user] Segfault when overriding Variant[]

tobi tobiasboege01 at ...1601...
Tue May 1 12:28:03 CEST 2012


On Tue, 01 May 2012, Benoît Minisini wrote:
> 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
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

Again, the attached project is not created with the IDE, I keep copying the project structure of one
to another for months ;) But it works fine with gbc3 and gbx3...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test4.tar
Type: application/x-tar
Size: 20480 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20120501/2be2f4e1/attachment.tar>


More information about the User mailing list