mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-24 14:45:53 +00:00
Handle deleting logfile at program shutdown in core destructor
* Prevents order-of-destructor issues from losing the log filename before the core destructor uses it to delete the logfile.
This commit is contained in:
@@ -256,12 +256,6 @@ void rdclog_filename(const char *filename)
|
||||
logfile() = filename;
|
||||
}
|
||||
|
||||
void rdclog_delete()
|
||||
{
|
||||
if(!logfile().empty())
|
||||
FileIO::Delete(logfile().c_str());
|
||||
}
|
||||
|
||||
void rdclog_flush()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -140,11 +140,9 @@ void rdclog_int(LogType type, const char *file, unsigned int line, const char *f
|
||||
|
||||
const char *rdclog_getfilename();
|
||||
void rdclog_filename(const char *filename);
|
||||
void rdclog_delete();
|
||||
|
||||
#define RDCLOGFILE(fn) rdclog_filename(fn)
|
||||
#define RDCGETLOGFILE() rdclog_getfilename()
|
||||
#define RDCLOGDELETE() rdclog_delete()
|
||||
|
||||
#if ( !defined(RELEASE) || defined(FORCE_DEBUG_LOGS) ) && !defined(STRIP_DEBUG_LOGS)
|
||||
#define RDCDEBUG(...) rdclog(RDCLog_Debug, __VA_ARGS__)
|
||||
|
||||
@@ -203,20 +203,20 @@ void RenderDoc::Initialise()
|
||||
// set default capture log - useful for when hooks aren't setup
|
||||
// through the UI (and a log file isn't set manually)
|
||||
{
|
||||
string capture_filename, logging_filename;
|
||||
string capture_filename;
|
||||
|
||||
const char *base = "RenderDoc_app";
|
||||
if(IsReplayApp())
|
||||
base = "RenderDoc_replay";
|
||||
|
||||
FileIO::GetDefaultFiles(base, capture_filename, logging_filename, m_Target);
|
||||
FileIO::GetDefaultFiles(base, capture_filename, m_LoggingFilename, m_Target);
|
||||
|
||||
if(m_LogFile.empty())
|
||||
SetLogFile(capture_filename.c_str());
|
||||
|
||||
string existingLog = RDCGETLOGFILE();
|
||||
FileIO::Copy(existingLog.c_str(), logging_filename.c_str(), true);
|
||||
RDCLOGFILE(logging_filename.c_str());
|
||||
FileIO::Copy(existingLog.c_str(), m_LoggingFilename.c_str(), true);
|
||||
RDCLOGFILE(m_LoggingFilename.c_str());
|
||||
}
|
||||
|
||||
if(IsReplayApp())
|
||||
@@ -262,6 +262,8 @@ RenderDoc::~RenderDoc()
|
||||
RDCLOG("'Leaking' unretrieved capture %s", m_Captures[i].path.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
FileIO::Delete(m_LoggingFilename.c_str());
|
||||
|
||||
m_RemoteServerThreadShutdown = true;
|
||||
// don't join, just close the thread, as we can't wait while in the middle of module unloading
|
||||
@@ -270,7 +272,7 @@ RenderDoc::~RenderDoc()
|
||||
|
||||
Network::Shutdown();
|
||||
|
||||
RDCLOGDELETE();
|
||||
FileIO::Delete(m_LoggingFilename.c_str());
|
||||
}
|
||||
|
||||
void RenderDoc::StartFrameCapture(void *wnd)
|
||||
|
||||
@@ -279,6 +279,8 @@ class RenderDoc
|
||||
vector<KeyButton> m_FocusKeys;
|
||||
vector<KeyButton> m_CaptureKeys;
|
||||
|
||||
string m_LoggingFilename;
|
||||
|
||||
string m_Target;
|
||||
string m_LogFile;
|
||||
string m_CurrentLogFile;
|
||||
|
||||
Reference in New Issue
Block a user