EAbstractError calling the show method of a TForm

No idea what is happening in my Delphi program
On one form, when I call the .show method, I get a EAbstractError exception
No idea of what to do to fix this
LVL 1
LeTayAsked:
Who is Participating?
 
zveljkovicConnect With a Mentor Commented:
Hmm, have you tried debugging? Try to step into the form.show; I cant see anything wrong here.
\
0
 
zveljkovicCommented:
Can you post which version of IDE are you using and upload project to some file hosting service so we can look at the problem?

( www.mediafire.com is in my opinion the best because there is no wait )
0
 
TheRealLokiSenior DeveloperCommented:
make sure you are not calling the Classname, but are actually calling the object name.
eg.
change your code from being
  TForm2.Show;
to
  Form2.Show;

-or-
  Form2.Create(Application);
to
 Form2 := TFrom2.Create(Application);

-or-
  with Form2.Create(application) do
  try
    Show
  finally
    Free;
  end;
to be
  with TForm2.Create(application) do
  try
    Show
  finally
    Free;
  end;
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
LeTayAuthor Commented:
I use Turbo Delphi 2006
What is strange, is that this sometimes works !
The main has this :   Application.CreateForm(TFMyForm, FMyForm);
Somewhere else I do : FMyForm.Show and this one clashes the program...

0
 
LeTayAuthor Commented:
What I have done as work-around now is this
At the place I want to use this form, I created it, instead that letting the Main creating it and now it works
I suspect a memory corruption problem...
0
 
zveljkovicCommented:
As i remember correctly in Delphi 2005 there are project options were you can select which forms to auto create at startup. Maybe that would help.
0
 
LeTayAuthor Commented:
This is exactly what I have done
But I still do not understand why it crashes when created the "standard" way...
0
 
zveljkovicCommented:
Please post your project somewhere so we can take a look. You can upload whole project on www.mediafire.com or paste few pages of source to the www.pastebin.com It will be a lot more helpful if we can see the code.
0
 
LeTayAuthor Commented:
A little bit difficult to post the project.
It is more than 20.000 lines of code with around 30 forms etc...
For the moment, I will test the work-around intensively and close this request if ok...
0
 
zveljkovicCommented:
can you then paste just code from that form that is causing you problems at www.pastebin.com and part of code when you create it?
0
 
Geert GOracle dbaCommented:
Do you have a OnCloseQuery event on that form
in which you give Action := caFree;
like

procedure TForm1.OnCloseQuery(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

if you open this form the first time, no problemmo, but
after closing the form, MyForm = nil

opening it the second time
MyForm.Show on an instance which is nil ....
causes AV

does this look like the problem ?
0
 
LeTayAuthor Commented:
No such clause but anyway, the forms does not show up even the very first time...
0
 
zveljkovicCommented:
Maybe the form is not initialized. In pascal constructors are not automatically called like in c/c++. So try to call Form.Create; or Form.Initialize; before calling Form.Show;  
0
 
zveljkovicCommented:
EAbstractError is when a function that is not implemented are invoked. Check out any inheritance in your app and make sure that there are all functions implemented.
0
 
LeTayAuthor Commented:
Hello zvelijkovic,
I understand that problem well.
Initially, the form was created in the main
and the show method called somewhere in the program when needed
There is nothing "special" in this form, I copy the form unit code here
What I have done to overcome the problem is that I have moved the form creating just before to call the show method, and now it works !
I have scanned all the units and there is no other reference to this form somewhere else...

unit UVueMemo;
 
interface
 
uses
  FastMM4,
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;
 
type
  TFVueMemo = class(TForm)
    MTexte: TMemo;
    BtnOK: TButton;
    CBCopie: TCheckBox;
    BtnAide: TBitBtn;
    BtnAnnuler: TButton;
    CBJoindreDonne: TCheckBox;
    LBPieces: TListBox;
    Label1: TLabel;
    JoindreBtn: TSpeedButton;
    OD: TOpenDialog;
    procedure MTexteDblClick(Sender: TObject);
    procedure BtnAideClick(Sender: TObject);
    procedure JoindreBtnClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  FVueMemo: TFVueMemo;
 
implementation
 
{$R *.dfm}
 
uses
 U01;
 
procedure TFVueMemo.FormActivate(Sender: TObject);
begin
 OD.InitialDir := ExeDir;
end;
 
procedure TFVueMemo.JoindreBtnClick(Sender: TObject);
begin
 if (not OD.Execute) then Exit;
 LBPieces.Items.Add(OD.FileName);
end;
 
procedure TFVueMemo.MTexteDblClick(Sender: TObject);
begin
 ModalResult := 1;
end;
 
procedure TFVueMemo.BtnAideClick(Sender: TObject);
begin
 Application.HelpContext(8);
end;
 
end.

Open in new window

0
 
LeTayAuthor Commented:
I have stepped in debug mode
As soon as I step on the show call of this form, I get the error
My feeling is that it is a bug related to the memory manager (here, FastMM4)
0
 
zveljkovicCommented:
Have you done step in  or step out debugging? First one ( in ) enters into the method so you can there to debug  while other one (out) just executes method without allowing you to debug internals of that method?
0
 
LeTayAuthor Commented:
Very interesting, zveljkovic, what I am discovering...
I rolled back my code with form creation just before Application.run
Stepping then in debug mode, at the place of .show, I "look" at the form component and it shows me very strange value for some properties, like top, left etc... I really looks corrupted, because when I look at it with the form creation just above the show, it look 100 % correct !
0
 
LeTayAuthor Commented:
I found MY mistake
Somewhere in the code, I freed an object that has not been created and that make probably the MM a little bit "nervous", can't it ?
Now it is okay
Thanks for your support. You can the points
0
 
LeTayAuthor Commented:
Thanks to you, I stepped in the code, looking at one of the form properties and saw what was the problem. Thanks !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.