[ntcore] Fix dangling pointer in logger (#3465)

This is a breaking change (it changes LogMessage::filename from const
char* to std::string) but there should be few users of it.
This commit is contained in:
Peter Johnson
2021-06-26 22:47:52 -07:00
committed by GitHub
parent 53b4891a5e
commit a371235b0d
4 changed files with 6 additions and 5 deletions

View File

@@ -258,7 +258,7 @@ struct NT_LogMessage {
unsigned int level;
/** The filename of the source file that generated the message. */
const char* filename;
char* filename;
/** The line number in the source file that generated the message. */
unsigned int line;

View File

@@ -243,7 +243,7 @@ class ConnectionNotification {
class LogMessage {
public:
LogMessage() = default;
LogMessage(NT_Logger logger_, unsigned int level_, const char* filename_,
LogMessage(NT_Logger logger_, unsigned int level_, std::string_view filename_,
unsigned int line_, std::string_view message_)
: logger(logger_),
level(level_),
@@ -258,7 +258,7 @@ class LogMessage {
unsigned int level{0};
/** The filename of the source file that generated the message. */
const char* filename{""};
std::string filename;
/** The line number in the source file that generated the message. */
unsigned int line{0};