Closing an application with popup showing gives Abstract Error...

Posted on 2004-11-07
Last Modified: 2010-04-05
Well here is the problem...
A little while ago I started using that Actionbands update in most of my  menu's. (including my popup menu's; <= TPopupActionBarEx)
Now I've noticed that when the main popup menu is open and I close my application I get an Abstract Error.
I tried debugging my program but this error appears when the debugger is already gone through my code...(After the FormClose Event).

If I change my popup menu's back to the origional style (TPopupMenu) and I close my app with the popup open, it all closes smoothly without any errors...

It would be a shame to convert any of my popup menus back to old style, it just doesn't look the same...

Thanks a lot for your time!
Question by:Samball
    LVL 3

    Expert Comment

    try not to free anything yourself
    i know that you have memory leaks in this way but it is for testing purposes only.

    if you don't get the error you know that you free something that is later used
    (or maybe freed) by the program.
    this should give you a starting point


    Author Comment

    Thanks Alfred,
    this gives me a better inside, well...a little any way.

    When I leave out all the Freeing of the objects I get the following error:

    Exception EAccessViolation even before the Abstract Error

    And this is comming from an Array of TTabsheets I created along the way, but if I destroy just these TTabsheets and the popup is open at closing time, I still get the Abstraction Error.

    Could it be that I am doing something wrong with my creation/Freeing?
    This is what I am doing:

          tabSheetArray: array of TTabSheet;

    procedure TForm.newTab();
         tabSheetArray[pageCount] := TTabSheet.Create(self);
         tabSheetArray[pageCount].Visible := false;
         tabSheetArray[pageCount].PageControl := myPageControl;
         tabSheetArray[pageCount].Visible := true;

    procedure TForm.FormClose(Sender: TObject; var Action: TCloseAction);
         oI : integer;
         for oI := 0 to pageCount - 1 do        

    Any suggestions...?

    LVL 3

    Accepted Solution

    you create the tabsheets with the owner set to self:
       tabSheetArray[pageCount] := TTabSheet.Create(self);

    that means when self (your form) is destroy it will destroy all
    controls it is owner of.

    so there are two ways to do it
    1.create the tabsheets with nil and free them yourself
        tabSheetArray[pageCount] := TTabSheet.Create(nil);

    2. create them with self and comment the free code in the formclose method as
       the form will do that for you


    Author Comment

    Well, I found the error...well kind off...
    What I did in the onCloseQuery was write to an Ini file.
    When I took this out and the popup was open it didnt give me any errors anymore, If I run the app without delphi (the .exe).
    Else when running it in Delphi I still get the error...
    For now, this is good enough for me...

    Thanks a lot for your help...
    You put me on the right path...

    LVL 3

    Expert Comment

    i'm glad that i was able to help

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    733 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

    20 Experts available now in Live!

    Get 1:1 Help Now