[Bf-blender-cvs] [79da4232b55] soc-2020-info-editor: Fix: clog: copy message on record init
Mateusz GrzeliÅski
noreply at git.blender.org
Thu Aug 6 18:41:04 CEST 2020
Commit: 79da4232b554399f180474eb47581ad49f280549
Author: Mateusz Grzeliński
Date: Wed Aug 5 10:28:31 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rB79da4232b554399f180474eb47581ad49f280549
Fix: clog: copy message on record init
===================================================================
M intern/clog/CLG_log.h
M intern/clog/clog.c
===================================================================
diff --git a/intern/clog/CLG_log.h b/intern/clog/CLG_log.h
index 08082c3ca7e..e79a6fdbb01 100644
--- a/intern/clog/CLG_log.h
+++ b/intern/clog/CLG_log.h
@@ -141,7 +141,7 @@ typedef struct CLG_LogRecord {
uint64_t timestamp;
const char *file_line;
const char *function;
- const char *message;
+ char *message;
} CLG_LogRecord;
/** clog version of ListBase */
@@ -169,7 +169,7 @@ CLG_LogRecord *clog_log_record_init(CLG_LogType *type,
unsigned short verbosity,
const char *file_line,
const char *function,
- char *message);
+ const char *message);
void clog_log_record_free(CLG_LogRecord *log_record);
/* Main initializer and distructor (per session, not logger). */
diff --git a/intern/clog/clog.c b/intern/clog/clog.c
index ccdfc64ca31..ade1e65df9e 100644
--- a/intern/clog/clog.c
+++ b/intern/clog/clog.c
@@ -406,7 +406,7 @@ CLG_LogRecord *clog_log_record_init(CLG_LogType *type,
unsigned short verbosity,
const char *file_line,
const char *function,
- char *message)
+ const char *message)
{
CLG_LogRecord *log_record = MEM_callocN(sizeof(*log_record), "ClogRecord");
log_record->type = type;
@@ -416,7 +416,10 @@ CLG_LogRecord *clog_log_record_init(CLG_LogType *type,
log_record->timestamp = clg_timestamp_ticks_get() - type->ctx->timestamp_tick_start;
log_record->file_line = file_line;
log_record->function = function;
- log_record->message = message;
+
+ char *_message = MEM_callocN(strlen(message) + 1, __func__);
+ strcpy(_message, message);
+ log_record->message = _message;
return log_record;
}
More information about the Bf-blender-cvs
mailing list