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 6118297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:25:12+00:00 2026-05-23T15:25:12+00:00

Is it safe to call close on a form and then call close again

  • 0

Is it safe to call close on a form and then call close again on it. no other operations are being done with it after the first close.

my suspicion is that this is bad and it is effectively racing the GC to call the second close? (and winning 99.999% of the time so I’m not seeing any error)

Edit: to be clear this is IMHO a bug, but it is not currently causing any exception to be thrown. the problem is more how big an issue is it? should I fix the one I’ve found and move on because it’s relatively benign, or should I review every form in the design to make sure there isn’t any similar issue on the grounds that the lack of exception may depend on GC behaviour.

  • 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-23T15:25:12+00:00Added an answer on May 23, 2026 at 3:25 pm

    The second call isn’t going to close the native window anymore, it’s gone. It will just call Dispose() again. Which is fine, disposing an object multiple times is supported in all .NET classes.

    None of this has anything to do with the garbage collector, clearly you still have a reference to the form object or you wouldn’t have been able to call Close(). Don’t keep this reference around forever or you’ll leak the form object. It is otherwise dead and can’t be revived. Referencing members of that form object tends to throw ObjectDisposedException.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but
This is closely related to Is it safe to signal and immediately close a
Is it safe to call rename(tmppath, path) without calling fsync(tmppath_fd) first? I want the
Ignoring programming style and design, is it safe to call delete on a variable
For a TCP blocking socket, is it safe to call: if(SOCKET_ERROR != recv(s, NULL,
Is the standard Java 1.6 javax.xml.parsers.DocumentBuilder class thread safe? Is it safe to call
How safe is it to use Silverlight in production for a graphic form? Is
Is it safe to assume that two itterations over the same collection will return
This is a pretty newbie question- please know I'm aware of that. I have
i have a modeless form. When the user is done with it, and they

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.