0

This is a really interesting error indeed :) I have a child form inheriting from a base form. The base form provides all sorts of virtual;abstract; services for use by children. This form uses all of them :) one of the services is a Save/Cancel system, which is coded in this way in the base form:

procedure TBaseRecordFrm.ConfirmSave(AVal: Boolean);
begin
  if AVal then
    PerformSave
  else
    PerformCancel;
  Close;
end;

The inherited form does something quite simple: in the Ok and Cancel button calls ConfirmSave with the appropriate parameter(True/False). The code for the two methods is pretty straight-forward:

procedure TActionFrm.PerformCancel;
begin
  if DMMain.CDSActionItems.State in dsEditModes then
    DMMain.CDSActionItems.Cancel;
end;

procedure TActionFrm.PerformSave;
begin
  if DMMain.CDSActionItems.State in dsEditModes then
    DMMain.CDSActionItems.Post;
end;

When pressing "Cancel", I get a "Privileged Instruction" exception. I am not doing anything spectacular as far as I can see. Anybody can shed some light, please? :)

Thank you!

Andrea

Andrea Raimondi
  • 527
  • 8
  • 30
  • That happens when you execute code that is meant to be run in ring 0, code that talks to hardware etc. Can happen with codegen compiler bug. – David Heffernan May 06 '13 at 14:00
  • Adding "MidasLib" to the project did the trick. Please note that I failed to mention I am building with packages(due to DevExpress trial) and this seems to not go down well with the Delphi IDE. – Andrea Raimondi May 06 '13 at 14:55

0 Answers0