bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

Segfault with Struct in struct passed as var #575

Closed GWRon closed 1 year ago

GWRon commented 2 years ago

I tried to spot a segfault in my game and run it via debug - and this was the first time the following "crash" happened:

so setColor in max2d: image

originally called this way (_DrawBox): image

And _DrawBox() is called by this one: Method DrawBox:SVec2I(txt:String,X:Float,Y:Float,w:Float,h:Float, alignment:SVec2F, color:SColor8, handle:SVec2F, parseInfo:STextParseInfo Var, options:EDrawTextOption = EDrawTextOption.None, effect:SDrawTextEffect Var, settings:SDrawTextSettings Var, limitFirstElement:Int = -1, limitLastElement:Int = -1)

So "parseInfo" (whose "color" is passed around) is passed as var there.

I use a lot of overloads for "DrawBox()" - so this might even have been called by an other "DrawBox()" (with less params etc).

Source of the methods: https://github.com/TVTower/TVTower/blob/master/source/Dig/base.gfx.bitmapfont.bmx

IMPORTANT: For now this STextParseInfo is NOT a struct (it did not work well with types - think there is a bug in bcc or so) hence I for now used a "type". Edit: seems current BCC can handle that now ... so will change that asap (albeit this means it might not work with last official "stable" release)

Does one of you see an issue in doing this at all? Might it be a red herring (the "var") ?

GWRon commented 1 year ago

New "stable" release for Windows was uploaded, so should be working now