-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Description
source_loc does not own the strings for file name and function name. this is a perfectly reasonable default in most use cases where this information is filled by the preprocessor.
however i'm running into a funny situation when trying to re-direct qt's logging to spdlog and using multithreaded logging:
- the qml engine uses heap-allocated strings for file/function name and fill
QMessageLogContextwith rawconst char*pointers (compare https://github.com/qt/qtdeclarative/blob/abb9cde13d6d0f503a8a6aad12f4361cd3848c79/src/qml/qml/qqmlengine.cpp#L1580-L1605) - i directly map
QMessageLogContextontosource_loc - in multi-thread spdlog we run into use-after-free issues (since the worker thread accesses the strings that are freed by the other thread)
i've been meditating a bit about this. it's a bit of an edge case, but it would be great if spdlog could provide a second api similar to source_loc, that uses owning std::string to allow applications to fill a source_loc from source locations other than c/c++
Metadata
Metadata
Assignees
Labels
No labels