View Issue Details

IDProjectCategoryView StatusLast Update
0006241JEDI VCLDonationpublic2016-08-04 21:18
ReporterCubicDesignAssigned ToAHUser 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in VersionDaily / GIT 
Summary0006241: Range check error in JvPaintFX.pas
DescriptionThere is a problem with the code donated by Jan (JvPaintFX.pas).
In the original code there was a {$R-} directive.
After the code was donated somebody removed that directive and now 'procedure Stretch' fails with a 'Range check error'.
That {$R-} was supposed to be there. The code is pre-Delphi 4 and it uses some some nasty trick to get the job done. This article (see post by Rob Kenedy) explains why the $R- must be there!!! http://stackoverflow.com/questions/628965/delphi-accessing-data-from-dynamic-array-that-is-populated-from-an-untyped-poi

Additional InformationThe code is really really bad. Needs massive improvement.
Things like this:

 TCListList = array[0..0] of TCList;
 PCListList = ^TCListList;

must be replaced with 'normal' arrays. This will make the nasty GemMem go away and SetLength will be used instead.

Also, things like this can be improved for speed:

       RGB.R := 0;
       RGB.G := 0;
       RGB.B := 0;

___________________


TagsNo tags attached.

Relationships

has duplicate 0006436 resolvedAHUser Crash in JvPaintFX.pas 

Activities

obones

2014-09-03 11:37

administrator   ~0021031

Please provide the zipped sources of a sample application showing this

AHUser

2015-09-27 16:42

developer   ~0021220

The $R- is in the jedi.inc, so it is still there.

CubicDesign

2015-09-28 11:29

reporter   ~0021225

I did a search for '$R' in jedi.inc but cannot find it

CubicDesign

2015-09-28 11:29

reporter   ~0021226

Is this the file?

\jcl\source\include\jedi\jedi.inc

CubicDesign

2015-09-28 11:34

reporter   ~0021227

Sorry... found it as: {$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF}

CubicDesign

2015-09-28 11:38

reporter   ~0021228

This means that Jedi library was never ran with $R+ ? $R+ helps the programmer discover bugs. But in this case, if you activate RangeChecking, then the code in JvPaintFX will fail. RangeChecking need to be locally disabled in that file, as it was in the original JanFX file.

AHUser

2015-09-28 15:29

developer   ~0021229

It's in the jvcl.inc the line "{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}"

The JVCL never used $R+. Sure it would be nice to check for range errors but enabling it for the JVCL would require a lot of code to be changed and there aren't enough developers left for this.

AHUser

2016-08-04 21:18

developer   ~0021334

Fixed in master branch

Issue History

Date Modified Username Field Change
2013-12-23 16:27 CubicDesign New Issue
2013-12-23 16:27 CubicDesign IDE version => Delphi/C++Builder XE
2014-05-17 17:26 AHUser Project JEDI Code Library => JEDI VCL
2014-09-03 11:37 obones Note Added: 0021031
2014-09-03 11:37 obones Status new => feedback
2015-09-27 16:42 AHUser Note Added: 0021220
2015-09-28 11:29 CubicDesign Note Added: 0021225
2015-09-28 11:29 CubicDesign Note Added: 0021226
2015-09-28 11:34 CubicDesign Note Added: 0021227
2015-09-28 11:38 CubicDesign Note Added: 0021228
2015-09-28 15:29 AHUser Note Added: 0021229
2016-08-04 21:17 AHUser Relationship added has duplicate 0006436
2016-08-04 21:18 AHUser Note Added: 0021334
2016-08-04 21:18 AHUser Status feedback => resolved
2016-08-04 21:18 AHUser Fixed in Version => Daily / GIT
2016-08-04 21:18 AHUser Resolution open => fixed
2016-08-04 21:18 AHUser Assigned To => AHUser