mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-16 21:56:00 +00:00
implement it thread-safe
This commit is contained in:
@@ -13,6 +13,7 @@ namespace ElectronNET.API
|
||||
public sealed class Dialog
|
||||
{
|
||||
private static Dialog _dialog;
|
||||
private static object _syncRoot = new Object();
|
||||
|
||||
internal Dialog() { }
|
||||
|
||||
@@ -22,7 +23,13 @@ namespace ElectronNET.API
|
||||
{
|
||||
if (_dialog == null)
|
||||
{
|
||||
_dialog = new Dialog();
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if(_dialog == null)
|
||||
{
|
||||
_dialog = new Dialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _dialog;
|
||||
|
||||
Reference in New Issue
Block a user