Skip to content

Commit 46fc0f8

Browse files
committed
Now disposes the event handler if a cancellation token is triggered while waiting for the HandleCreated event
1 parent 418171b commit 46fc0f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms/Extensions/RichTextBoxExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public static void SetRtf(this RichTextBox richTextBox, string rtf, bool autoScr
6363
var mre = new ManualResetEventSlim();
6464
EventHandler eh = (sender, args) => mre.Set();
6565
richTextBox.HandleCreated += eh;
66-
if (richTextBox.IsHandleCreated) mre.Set();
6766
try
6867
{
68+
if (richTextBox.IsHandleCreated) mre.Set();
6969
mre.Wait(token);
7070
}
7171
finally

0 commit comments

Comments
 (0)