#1260 access c_str of reference not temporary value for var_server_get_user_tag (#1264)

closes #1260
This commit is contained in:
Scott Fennell 2022-05-17 11:42:08 -05:00 committed by GitHub
parent 7c58425f9a
commit 3bece7f73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,7 @@ namespace Trick {
void set_port(unsigned short in_port) ;
std::string get_user_tag() ;
std::string& get_user_tag_ref() ;
void set_user_tag(std::string in_tag) ;
void set_source_address(const char * address) ;

View File

@ -47,6 +47,10 @@ std::string Trick::VariableServerListenThread::get_user_tag() {
return user_tag ;
}
std::string& Trick::VariableServerListenThread::get_user_tag_ref() {
return user_tag ;
}
void Trick::VariableServerListenThread::set_user_tag(std::string in_tag) {
user_tag = in_tag ;
}

View File

@ -434,7 +434,7 @@ extern "C" void var_server_set_source_address(const char * source_address) {
* C wrapper Trick::VariableServer::get_user_tag
*/
extern "C" const char * var_server_get_user_tag(void) {
return(the_vs->get_listen_thread().get_user_tag().c_str()) ;
return(the_vs->get_listen_thread().get_user_tag_ref().c_str()) ;
}
/**