mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Protect against ArgumentException in Timeline Bar paint
* Crash report was submitted indicating a crash here, which is either memory issues or momentarily crazy-large window. We can catch the exception and just clear to black.
This commit is contained in:
@@ -708,6 +708,8 @@ namespace renderdocui.Windows
|
||||
|
||||
private PointF m_CurrentMarker = new PointF(-1, -1);
|
||||
|
||||
private bool m_FailedPaint = false;
|
||||
|
||||
private void panel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if(ClientRectangle.Width <= 0 || ClientRectangle.Height <= 0)
|
||||
@@ -715,7 +717,24 @@ namespace renderdocui.Windows
|
||||
|
||||
Cursor = Cursors.Arrow;
|
||||
|
||||
var bmp = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
|
||||
Bitmap bmp = null;
|
||||
|
||||
try
|
||||
{
|
||||
bmp = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
|
||||
}
|
||||
catch (System.ArgumentException)
|
||||
{
|
||||
// out of memory or huge bitmap. Clear to black rather than crashing
|
||||
e.Graphics.Clear(Color.Black);
|
||||
|
||||
if(!m_FailedPaint)
|
||||
{
|
||||
renderdoc.StaticExports.LogText("Failed to paint TimelineBar - System.ArgumentException");
|
||||
m_FailedPaint = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var g = Graphics.FromImage(bmp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user