Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[mt] do not allow exception to escape from the Actor
Signed-off-by: Denis Zalevskiy <denis.zalevskiy@jolla.com>
  • Loading branch information
Denis Zalevskiy committed Nov 9, 2015
1 parent 28a948d commit 8166130
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/mt.cpp
Expand Up @@ -116,11 +116,17 @@ ActorImpl::~ActorImpl()

void ActorImpl::run()
{
auto ctx = std::static_pointer_cast<ActorContext>(std::move(obj_));
obj_ = ctx->ctor_();
ctx->notify_(std::move(ctx->actor_));
exec();
obj_.reset();
try {
auto ctx = std::static_pointer_cast<ActorContext>(std::move(obj_));
obj_ = ctx->ctor_();
ctx->notify_(std::move(ctx->actor_));
exec();
obj_.reset();
} catch (std::exception const &e) {
debug::critical("Uncaught exception in thread", this, ":", e.what());
} catch (...) {
debug::critical("Uncaught exception in", this, ", exiting thread");
}
}

bool ActorImpl::postEvent(QEvent *e)
Expand Down

0 comments on commit 8166130

Please sign in to comment.