mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Don't allow the program to close while a global hook is active
This commit is contained in:
@@ -59,6 +59,7 @@ namespace renderdocui.Code
|
||||
|
||||
private bool m_LogLocal = false;
|
||||
private bool m_LogLoaded = false;
|
||||
private bool m_GlobalHookEnabled = false;
|
||||
|
||||
private FileSystemWatcher m_LogWatcher = null;
|
||||
|
||||
@@ -119,6 +120,8 @@ namespace renderdocui.Code
|
||||
public string LogFileName { get { return m_LogFile; } set { if (LogLoaded) m_LogFile = value; } }
|
||||
public bool IsLogLocal { get { return m_LogLocal; } set { m_LogLocal = value; } }
|
||||
|
||||
public bool GlobalHookEnabled { get { return m_GlobalHookEnabled; } set { m_GlobalHookEnabled = value; } }
|
||||
|
||||
public FetchFrameInfo FrameInfo { get { return m_FrameInfo; } }
|
||||
|
||||
public APIProperties APIProps { get { return m_APIProperties; } }
|
||||
|
||||
@@ -928,6 +928,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
toggleGlobalHook.Enabled = false;
|
||||
|
||||
m_Core.GlobalHookEnabled = false;
|
||||
|
||||
if (toggleGlobalHook.Checked)
|
||||
{
|
||||
if(!Helpers.IsElevated)
|
||||
@@ -1124,6 +1126,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
logfile = m_Core.TempLogFilename(logfile);
|
||||
|
||||
StaticExports.StartGlobalHook(exe, logfile, GetSettings().Options);
|
||||
|
||||
m_Core.GlobalHookEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1709,6 +1709,14 @@ namespace renderdocui.Windows
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Core.GlobalHookEnabled)
|
||||
{
|
||||
MessageBox.Show("Cannot close RenderDoc while global hook is active.", "Global hook active",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PromptCloseLog())
|
||||
{
|
||||
e.Cancel = true;
|
||||
|
||||
Reference in New Issue
Block a user