Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3605882
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:10:45+00:00 2026-05-18T21:10:45+00:00

I have an MDI application in which I have a MDI child doing some

  • 0

I have an MDI application in which I have a MDI child doing some processing (needs 10-20 seconds to finish). I have discovered that if I close the main application, it crashes because the MDI child is closed to early (before finishing its processing).

The code is like this (it is way too complicated to put all code in here):

mainForm.OnButtonClick
begin
  start data processing;                         <--- 10 seconds
  create MDI child;                              <--- instant
     create visual controls (runtime)            <== 
        display the processed data in MDI child; <== 1 sec
end;

The program crashes on the 3rd line. FastMM says that “FastMM has detected an attempt to call a virtual method on a freed object”. Obviously the MDI child has been freed.

How to prevent this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:10:45+00:00Added an answer on May 18, 2026 at 9:10 pm

    In your MDI child window, do

    procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      CanClose := not IsWorking;
    end;
    

    and do

    mainForm.OnButtonClick
    begin
      IsWorking := true;
      try
        start data processing;                         <--- 10 seconds
        create MDI child;                              <--- instant
           create visual controls (runtime)            <== 
              display the processed data in MDI child; <== 1 sec
      finally
        IsWorking := false;
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written an MDI based application, in which the child forms are of
Hi I have an MDI application where a child window handles a number of
I have a bunch of MDI child nodes that are all created in the
I have an MDI form and several number of child forms inside that MDI.
I have an MDI application. When I show a message box using MessageBox.Show(), the
I have a MDI application written in Delphi 2007. If the user exits a
Using C# and the .Net framework 2.0. I have an MDI application and need
I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding
I have the following scenario I have a main form as MDI parent and
I have a control in my parent mdi form which I wish to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.