bgrabitmap / bgracontrols

🆗 BGRA Controls is a set of graphical UI elements that you can use with Lazarus LCL applications.
https://bgrabitmap.github.io/bgracontrols/
189 stars 32 forks source link

BGRASHAPE Borderstyle crash Access Violation #112

Closed josh2008 closed 3 years ago

josh2008 commented 3 years ago

placing a BGRASHAPE and then setting BorderStyle to psClear, causes a crash and access violation in IDE. Any project that previously has this set will not open.

bgracontrols 7.3 bgrabitmap 11.3.1

Notice then when ugrading a project using 4.6.2 / 9.8.1.

lainz commented 3 years ago

Hi, nothing changed in BGRAShape, maybe it's a BGRABitmap change. @circular17 any ideas?

It says 'Invalid pen dash length' when selecting psClear from the object inspector.

willingtonvr commented 3 years ago

Hi, this is my frist time looking at BGRABitmap code, hope this will helpful to someone.

I've tried all the penstyles and same problem (psClear, psSolid, psDash .. etc)

I had to hardcode the bgrapen.pas (BGRABitmap package) line 350 to overcome the problem and continue develop my app just put :

Line 348 if penstyle[i] <= 0 then 349 //raise Exception.Create('Invalid pen dash length ' ) 350 penstyle[i]:=0.1

didn't see any artifacts on Shapes, i'm on hurry to finish my app, this time i can live with this non orthodox 'temporal' solution

so far, the problem is realated to function 'ComputeWidePolylinePoints' that renders on penstyle = 0 (TBGRAPenStyle) there is a lot of matrix operations on these, seems that on some point the first element of 'penstyle' array got zero value.

by geometrytypes.inc line 1247 zero value is not valid. that's why i put penstyle[i]:=0.1.

circular17 commented 3 years ago

Thanks for the feedback. I found the problem and fixed it on dev branch. It was related to handing odd-length pen styles in BGRACanvas.