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

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!
SamballAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gandalf_the_whiteCommented:
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

regards
alfred
0
SamballAuthor Commented:
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:

private
      tabSheetArray: array of TTabSheet;
....

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

procedure TForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
     oI : integer;
begin
     for oI := 0 to pageCount - 1 do        
            tabSheet[oI].free;
end;


Any suggestions...?




0
gandalf_the_whiteCommented:
hmm
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


alfred
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SamballAuthor Commented:
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...
,

Samball...
0
gandalf_the_whiteCommented:
np
i'm glad that i was able to help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

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.