Skip to content

Commit

Permalink
SKALE-3135 fixed incorrect reset of smart pointers in main() module
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiy-skalelabs committed Aug 28, 2020
1 parent 56e2873 commit f1dd646
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions skaled/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ int main( int argc, char** argv ) try {
if ( !stopWasRaisedBefore ) {
if ( g_jsonrpcIpcServer.get() ) {
g_jsonrpcIpcServer->StopListening();
g_jsonrpcIpcServer.release();
g_jsonrpcIpcServer.reset( nullptr );
}
if ( g_client ) {
g_client->stopWorking();
Expand Down Expand Up @@ -2259,11 +2259,11 @@ int main( int argc, char** argv ) try {
}
if ( g_jsonrpcIpcServer.get() ) {
g_jsonrpcIpcServer->StopListening();
g_jsonrpcIpcServer.release();
g_jsonrpcIpcServer.reset( nullptr );
}
if ( g_client ) {
g_client->stopWorking();
g_client.release();
g_client.reset( nullptr );
}

std::cerr << localeconv()->decimal_point << std::endl;
Expand All @@ -2281,25 +2281,25 @@ int main( int argc, char** argv ) try {
} catch ( const Client::CreationException& ex ) {
clog( VerbosityError, "main" ) << dev::nested_exception_what( ex );
// TODO close microprofile!!
g_client.release();
g_client.reset( nullptr );
return EXIT_FAILURE;
} catch ( const SkaleHost::CreationException& ex ) {
clog( VerbosityError, "main" ) << dev::nested_exception_what( ex );
// TODO close microprofile!!
g_client.release();
g_client.reset( nullptr );
return EXIT_FAILURE;
} catch ( const std::exception& ex ) {
clog( VerbosityError, "main" ) << "CRITICAL " << dev::nested_exception_what( ex );
clog( VerbosityError, "main" ) << "\n"
<< skutils::signal::generate_stack_trace() << "\n"
<< std::endl;
g_client.release();
g_client.reset( nullptr );
return EXIT_FAILURE;
} catch ( ... ) {
clog( VerbosityError, "main" ) << "CRITICAL unknown error";
clog( VerbosityError, "main" ) << "\n"
<< skutils::signal::generate_stack_trace() << "\n"
<< std::endl;
g_client.release();
g_client.reset( nullptr );
return EXIT_FAILURE;
}

0 comments on commit f1dd646

Please sign in to comment.