mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 02:45:36 +00:00
Replaced Control.Invoke() by Control.BeginInvoke() to avoid deadlock when Debug.Print() is called from the finalizing thread.
This commit is contained in:
parent
b7390e11d2
commit
cdfe975427
|
@ -3,13 +3,14 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
|
||||
namespace Examples
|
||||
{
|
||||
public class TextBoxTraceListener : TraceListener
|
||||
{
|
||||
private TextBox _target;
|
||||
private StringSendDelegate _invokeWrite;
|
||||
TextBox _target;
|
||||
StringSendDelegate _invokeWrite;
|
||||
|
||||
public TextBoxTraceListener(TextBox target)
|
||||
{
|
||||
|
@ -20,13 +21,13 @@ namespace Examples
|
|||
public override void Write(string message)
|
||||
{
|
||||
if (_target.Created)
|
||||
_target.Invoke(_invokeWrite, new object[] { message });
|
||||
_target.BeginInvoke(_invokeWrite, new object[] { message });
|
||||
}
|
||||
|
||||
public override void WriteLine(string message)
|
||||
{
|
||||
if (_target.Created)
|
||||
_target.Invoke(_invokeWrite, new object[] { message + Environment.NewLine });
|
||||
_target.BeginInvoke(_invokeWrite, new object[] { message + Environment.NewLine });
|
||||
}
|
||||
|
||||
private delegate void StringSendDelegate(string message);
|
||||
|
|
Loading…
Reference in a new issue