Skip to content

Commit a0449ad

Browse files
committed
Fix cancellations and serial exceptions not being propagated up.
1 parent 36eb33d commit a0449ad

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

ClientSource/Connection/BotBase.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ BotBaseContext::BotBaseContext(CancellableScope& parent, BotBaseContext& context
2929
}
3030
BotBaseContext::~BotBaseContext(){
3131
m_lifetime_sanitizer.check_usage();
32+
detach();
3233
try{
3334
m_botbase.wait_for_all_requests(this);
34-
}catch (...){}
35-
detach();
35+
}catch (...){
36+
// cout << "canceled with exception: " << this << endl;
37+
CancellableScope* parent = scope();
38+
if (parent){
39+
parent->cancel(std::current_exception());
40+
}
41+
}
3642
}
3743

3844
void BotBaseContext::wait_for_all_requests() const{

SerialPrograms/Source/CommonFramework/InferenceInfra/InferenceRoutines.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ int run_until(
7878
stream, context,
7979
[&](CancellableScope& scope){
8080
ContextType subcontext(scope, context);
81-
command(subcontext);
81+
if (command){
82+
command(subcontext);
83+
}
84+
// subcontext.wait_for_all_requests();
8285
},
8386
callbacks,
8487
default_video_period,

0 commit comments

Comments
 (0)