Access violation in ParaRVFrm

General TRichView support forum. Please post your questions here
Post Reply
Mason Wheeler
Posts: 2
Joined: Wed Jun 25, 2014 6:31 pm

Access violation in ParaRVFrm

Post 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;
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Mason Wheeler
Posts: 2
Joined: Wed Jun 25, 2014 6:31 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

This form was designed for internal use, so it does not check parameters - it expects them to be correct.
Post Reply