Page 1 of 1

Access violation in ParaRVFrm

Posted: Wed Jun 25, 2014 6:36 pm
by Mason Wheeler
It's possible to create a TfrmRVPara and pass nil to both constructor arguments. Unfortunately, there are several methods that assume that ControlPanel (the second parameter above) <> nil.

From looking at related code, it appears that this can be remedied by adding the following to FormCreate, before the first call to UpdateLengthSpinEdit (which is one of the methods that will crash otherwise):

if ControlPanel=nil then
ControlPanel := MainRVAControlPanel;

Posted: Thu Jun 26, 2014 11:17 am
by Sergey Tkachenko
Do you create this form yourself, without actions?
If yes, you can pass MainRVAControlPanel as a parameter.

When actions create this form, they pass ControlPanel linked with the calling action.

Posted: Thu Jun 26, 2014 6:39 pm
by Mason Wheeler
Yes, the form is being created directly in the code in question. (I didn't write it; I'm just the guy who has to debug it.)

And yes, you can pass MainRVAControlPanel as a parameter... if you know about it. The point I'm making is that the constructor accepts nil as a parameter, which then leads to invalid behavior down the line. Either the constructor should raise an exception, or the object should assume the responsibility of correcting this internally.

Posted: Fri Jun 27, 2014 11:40 am
by Sergey Tkachenko
This form was designed for internal use, so it does not check parameters - it expects them to be correct.