0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd: Handle exceptions before unwind of class member reference.

This commit is contained in:
Jason Volk 2019-06-23 23:17:49 -06:00
parent 809d01d7df
commit 7157a9cf8b
3 changed files with 28 additions and 28 deletions

View file

@ -640,8 +640,7 @@ catch(const std::exception &e)
{ {
log::critical log::critical
{ {
log, "socket(%p) ~client(%p): %s", log, "~client(%p): %s",
sock.get(),
this, this,
e.what() e.what()
}; };

View file

@ -1690,21 +1690,21 @@ noexcept
} }
ircd::fs::fd::~fd() ircd::fs::fd::~fd()
noexcept try noexcept
{ {
if(fdno < 0) if(likely(fdno >= 0)) try
return; {
syscall(::close, fdno); syscall(::close, fdno);
} }
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::critical log::critical
{ {
"Failed to close fd:%d :%s", "Failed to close fd:%d :%s",
fdno, fdno,
e.what() e.what()
}; };
}
} }
int int

View file

@ -4796,7 +4796,6 @@ const
/// Primary hook ctor /// Primary hook ctor
ircd::m::hook::base::base(const json::members &members) ircd::m::hook::base::base(const json::members &members)
try
:_feature :_feature
{ {
_hook_make_feature(members) _hook_make_feature(members)
@ -4810,18 +4809,20 @@ try
feature feature
} }
{ {
site *site; site *site; try
{
if((site = find_site())) if((site = find_site()))
site->add(*this); site->add(*this);
} }
catch(...) catch(...)
{ {
if(!registered) if(registered)
throw; {
auto *const site(find_site()); auto *const site(find_site());
assert(site != nullptr); assert(site != nullptr);
site->del(*this); site->del(*this);
}
}
} }
ircd::m::hook::base::~base() ircd::m::hook::base::~base()