Solved

EAbstractError calling the show method of a TForm

Posted on 2008-06-15
20
376 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
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
 

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 36

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now