Re: Crash during throw_func()
- From: "Matt Hoosier" <matt hoosier gmail com>
- To: "Paul Davis" <pjdavis engineering uiowa edu>
- Cc: Murray Cumming <murrayc murrayc com>, gtkmm-list gnome org
- Subject: Re: Crash during throw_func()
- Date: Thu, 26 Oct 2006 08:46:34 -0500
On 10/26/06, Paul Davis <pjdavis engineering uiowa edu> wrote:
One method occurred to me, its rather nutty, and I'd probably not like to
use it, but you could do something like:
void
Handle::RegisterCloseError(
std::auto_ptr<Gnome::Vfs::exception> error )
{
//store error handle somewhere
}
Handle::~Handle()
{
if( gobj() )
close( 'stored error handle' ) ;
}
And, not to be a stickler, but throwinig errors from a destructor is a Bad
Idea (TM).
See:
http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.3
So really, regardless of whether exceptions are enabled, this might need to
be looked at.
Agreed. Maybe a bug should be filed as a reminder to change this in
the next ABI version (right now [2.14], it's still compatible with
2.6).
Paul
On 10/25/06, Murray Cumming <murrayc murrayc com> wrote:
>
> On Wed, 2006-10-25 at 10:35 -0500, Matt Hoosier wrote:
> > Good idea. What's the preferred way to handle situations like this:
> >
> > Handle::~Handle()
> > {
> > if(gobj())
> > close(); // This may throw an exception
> > }
> >
> > There's not really an opportunity to pass back the auto_ptr<exception>
> > in this case. Should we just do:
> >
> > Handle::~Handle()
> > {
> > if(gobj())
> > {
> > std::auto_ptr<Gnome::Vfs::exception> error;
> > close(error);
> > }
> > }
> >
> > and ignore the fact that the error may be set?
>
> I think that's the only way. I can't see how we could do anything else
> during a destructor.
>
> --
> Murray Cumming
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]