Solved

EAbstractError calling the show method of a TForm

Posted on 2008-06-15
20
388 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:LeTay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
20 Comments
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21789734
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
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 21789980
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
 

Author Comment

by:LeTay
ID: 21791623
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:LeTay
ID: 21791694
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
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21791726
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
 

Author Comment

by:LeTay
ID: 21791757
This is exactly what I have done
But I still do not understand why it crashes when created the "standard" way...
0
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21791778
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
 

Author Comment

by:LeTay
ID: 21791842
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
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21791852
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
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 21793224
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
 

Author Comment

by:LeTay
ID: 21793489
No such clause but anyway, the forms does not show up even the very first time...
0
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21794540
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
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21794589
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
 

Author Comment

by:LeTay
ID: 21800779
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
 
LVL 4

Accepted Solution

by:
zveljkovic earned 500 total points
ID: 21801119
Hmm, have you tried debugging? Try to step into the form.show; I cant see anything wrong here.
\
0
 

Author Comment

by:LeTay
ID: 21801168
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
 
LVL 4

Expert Comment

by:zveljkovic
ID: 21801778
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
 

Author Comment

by:LeTay
ID: 21802243
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
 

Author Comment

by:LeTay
ID: 21802470
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
 

Author Closing Comment

by:LeTay
ID: 31467394
Thanks to you, I stepped in the code, looking at one of the form properties and saw what was the problem. Thanks !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question