Skip to content

Commit

Permalink
Fix crash with display mode switch.
Browse files Browse the repository at this point in the history
With slow display update it could happen that on
display mode switch the underlying C++ implementation
was already freed while signaling the view was
still in progress.

Protect with better check.

#RH-34776
  • Loading branch information
jesterKing committed Jul 1, 2016
1 parent 2981391 commit 40e31f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
16 changes: 16 additions & 0 deletions RenderEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ public partial class RenderEngine : AsyncRenderContext
/// </summary>
public Client Client { get; set; }

/// <summary>
/// True when State.Rendering
/// </summary>
public bool IsRendering { get { return State == State.Rendering; } }
/// <summary>
/// True when State.Uploading
/// </summary>
public bool IsUploading { get { return State == State.Uploading; } }
/// <summary>
/// True when State.Waiting
/// </summary>
public bool IsWaiting { get { return State == State.Waiting; } }
/// <summary>
/// True when State.IsStopped
/// </summary>
public bool IsStopped { get { return State == State.Stopped; } }
/// <summary>
/// Current render engine state.
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions Viewport/RenderedViewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ void m_cycles_PassRendered(object sender, ViewportRenderEngine.PassRenderedEvent
m_frame_available = true;
m_available = true;
m_started = true;
if(e.Sample <=1) SetView(e.View);
SignalRedraw();
if (m_cycles?.IsRendering ?? false)
{
if (e.Sample <= 1) SetView(e.View);
SignalRedraw();
}
}

void m_cycles_StartSynchronizing(object sender, EventArgs e)
Expand Down

0 comments on commit 40e31f4

Please sign in to comment.