Jump to content
Al T

(Solved) Why is FScrollBars[isb].Value:=sNum; causing FMX to crash? (open source) VCL version doesn't crash!

Recommended Posts

procedure TFormAthenaVST.UpdateEditorParameter(index:integer;value: double);
VAR isb:integer;
    sNum:single;
begin
  WriteLog('TFormAthenaVST.UpdateEditorParameter(index:' + index.ToString + ' value:' + value.ToString);
  for isb:=0 to 2 do
    if index = ID_CUTOFF+isb then
      begin
        WriteLog('FScrollBars[' + isb.ToString + '].Value:=round(100*value)');
        sNum := round(100*value);
        WriteLog('sNum = ' + sNum.ToString);
        FScrollBars[isb].Value:=sNum;
        WriteLog('AFTER FScrollBars[isb].Value:=sNum;');
      end;
  WriteLog('TFormAthenaVST.UpdateEditorParameter END');
end;

https://github.com/War3Evo/RMSVST3/blob/Delphi-11.0/FMX_AthenaVST3/UAthenaVSTForm.pas#L149-L164

 

You can find all the source code here: https://github.com/War3Evo/RMSVST3/tree/Delphi-11.0/FMX_AthenaVST3

 

WriteLog uses CodeSite Express... CakeWalk by BandLabs crashes on FScrollBars[isb].Value:=sNum;

 

The VCL version does not crash but also uses FScrollBars[isb].Position:=round(100*value);

 

Your help is much appreciated!

 

Edited by Al T
CodeSite Express

Share this post


Link to post

I'm starting to guess I need to convert Int64 to Single... opps

 

Is there a directive I need to enable for Delphi to catch that before I compile it??

 

--okay that isn't what I thought it was... still stumped.

 

I'm now thinking

procedure TFormAthenaVST.UpdateEditorParameter(index:integer;value: double);

the value needs a rename??

 

Edited by Al T

Share this post


Link to post

okay.. it isn't the value or sNum...

 

It's FScrollBars[isb]

 

something about FScrollBars[isb] crashes it... cause I called:

 

procedure TFormAthenaVST.UpdateEditorParameter(index:integer; dvalue: double);
VAR isb:integer;
    sNum:single;
begin
  WriteLog('TFormAthenaVST.UpdateEditorParameter(index:' + index.ToString + ' dvalue:' + dvalue.ToString);
  for isb:=0 to 2 do
    if index = ID_CUTOFF+isb then
      begin
        WriteLog('FScrollBars[' + isb.ToString + '].Value:=(100*value)');
        //sNum := round(100*dvalue);
        sNum := 100*dvalue;
        WriteLog('FScrollBars[isb].BeginUpdate');
        FScrollBars[isb].BeginUpdate;
        WriteLog('sNum = ' + sNum.ToString);
        FScrollBars[isb].Value:=sNum;
        WriteLog('FScrollBars[isb].EndUpdate');
        FScrollBars[isb].EndUpdate;
        WriteLog('AFTER FScrollBars[isb].Value:=sNum;');
      end;
  WriteLog('TFormAthenaVST.UpdateEditorParameter END');
end;

It crashes right after WriteLog('FScrollBars[isb].BeginUpdate');

Share this post


Link to post

Solved:

 

procedure FormCreate(Sender: TObject);  IS in the source code... but on the form component it is not assigned to the procedure!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×