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

  • SEARCH
  • Home
  • 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 a windows application with an MDI form and some child forms. I
I have a MDI container form, and some child forms that update their title
I have an MDI application that initially doesn't have the main window open. When
I have a simple MFC MDI application, where there is main CFormView, in which
I have written an MDI based application, in which the child forms are of
I have an MDI application. I have a ToolStripMenuItem labeled Window that is set
I have created MDI application in Delphi. Lets assume that I have a bunch
I have a MDI Application with one MDI child. When a user changes a
I have a .NET 3.5 MDI WinForms application. I set a a child form's
I have an MDI Windows Forms application (.net 2008) that allows the user to

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.