🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2736

Re: Creating new TForm causes 'Out of Resources' error on WinXP

#2736
From: Dan Mayo
Date: Fri, 19 Jan 2007 15:11
29 lines
2294 bytes
Is there anything wrong with doing destruction of a form like this?
theForm->Release();
Application->ProcessMessages();
//then go on my merry way... (I was noticing without ProcessMessages 
that theForm was still in memory..

Is there a better way?

Dan Mayo wrote:
>  From the help file:
> "Note:    When working with form objects, do not explicitly call the 
> Free or Destroy method to free them. Instead, use the Release method, 
> which waits until all event handlers have finished executing."
> 
> Does this mean I should call "theDialog->Release();" rather than "delete 
> theDialog;"?
> 
> Reading the "Release()" function call help the note appears 
> contradictory to the TForm() section:
> 
> "Note:    Release returns immediately to the caller. It does not wait 
> for the form to be freed before returning."
> 
> So does Release() wait for everything to be done first before returning 
> to the next line in code?  Do I need to call both Release() and then 
> delete?  Is there something I should do to make sure that Release() has 
> finished prior to calling delete?
> 
> Dan
Technical Details
Message-ID: <45b0dfca@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45afcda9$1@newsgroups.borland.com> <45afd2ea$1@newsgroups.borland.com> <45afd751$1@newsgroups.borland.com> <45afe953$1@newsgroups.borland.com> <45aff139$1@newsgroups.borland.com> <rgh1r2ln049empurv72i8uith6amj1hl4c@4ax.com> <45b0d38c@newsgroups.borland.com> <45b0d69a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,81568e00a202778e
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 19 Jan 2007 09:11:41 -0600
From: Dan Mayo <dmayo@dickey-john.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Creating new TForm causes 'Out of Resources' error on WinXP
References: <45afcda9$1@newsgroups.borland.com> <45afd2ea$1@newsgroups.borland.com> <45afd751$1@newsgroups.borland.com> <45afe953$1@newsgroups.borland.com> <45aff139$1@newsgroups.borland.com> <rgh1r2ln049empurv72i8uith6amj1hl4c@4ax.com> <45b0d38c@newsgroups.borland.com> <45b0d69a$1@newsgroups.borland.com>
In-Reply-To: <45b0d69a$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.174.165.174
Message-ID: <45b0dfca@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1169219530 216.174.165.174 (19 Jan 2007 07:12:10 -0800)
Lines: 29
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail