🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TThread & CloseHandle

#5630
From: Remy Lebeau (TeamB)
Date: Fri, 05 Aug 2005 17:49
28 lines
1941 bytes
"Tassilo J. Klein" <nospamTJKlein@web.de> wrote in message
news:dcviup$pn$04$1@news.t-online.com...

> Here is a part of the code of the TThread. But everything
> critical is encapsulated with try and catch(...).

Like I said, that will NOT necessarily catch every exception.  Especially
exceptions being thrown from the Win32 API  You generally have to use a
lower-level exception handler for those, such as by using a try/__except()
block instead:

>                          throw(TRANSFER_ERROR);

What is TRANSFER_ERROR declared as?  Is it an int?  It is best to catch what
you actually throw, ie:

    catch(int &i)

>       CloseHandle( hCom ); }              <-------- from here the
> debugger steps to the destructor of the download thread

You did not show enough code to diagnose the problem.  Where is 'device'
allocated and freed?  For CloseHandle() to crash, 'hCom' would have to be
invalid first.


Gambit
Technical Details
Message-ID: <42f3a6ca$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <dctdlr$6gr$02$1@news.t-online.com> <42f24cfe$1@newsgroups.borland.com> <dcviup$pn$04$1@news.t-online.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,185dcaeb91f025d5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <dctdlr$6gr$02$1@news.t-online.com> <42f24cfe$1@newsgroups.borland.com> <dcviup$pn$04$1@news.t-online.com>
Subject: Re: TThread & CloseHandle
Date: Fri, 5 Aug 2005 10:49:07 -0700
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <42f3a6ca$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1123264202 68.69.17.41 (5 Aug 2005 10:50:02 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail