mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
PowerToys Run cache issue (#4472)
* Clean termination of powertoys process. * Fixed issue with run not responding to WM_CLOSE * Fixed serialization error in pinyin and image cache * Fixed merge conflict * Fixed nit wrt to master * Fixed undeterministic behaviour of Environment.Exit function * Update timing for terminate process
This commit is contained in:
committed by
GitHub
parent
aad2e8012b
commit
92fa8b7421
@@ -22,12 +22,13 @@ using interop;
|
||||
|
||||
namespace Wox.ViewModel
|
||||
{
|
||||
public class MainViewModel : BaseModel, ISavable
|
||||
public class MainViewModel : BaseModel, ISavable, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private bool _isQueryRunning;
|
||||
private Query _lastQuery;
|
||||
private static bool _disposed;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
|
||||
private readonly WoxJsonStorage<History> _historyItemsStorage;
|
||||
@@ -55,6 +56,7 @@ namespace Wox.ViewModel
|
||||
_saved = false;
|
||||
_queryTextBeforeLeaveResults = "";
|
||||
_lastQuery = new Query();
|
||||
_disposed = false;
|
||||
|
||||
_settings = settings;
|
||||
|
||||
@@ -112,14 +114,6 @@ namespace Wox.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
~MainViewModel()
|
||||
{
|
||||
if (_hotkeyHandle != 0)
|
||||
{
|
||||
_hotkeyManager.UnregisterHotkey(_hotkeyHandle);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeKeyCommands()
|
||||
{
|
||||
IgnoreCommand = new RelayCommand(_ => {});
|
||||
@@ -715,6 +709,28 @@ namespace Wox.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (_hotkeyHandle != 0)
|
||||
{
|
||||
_hotkeyManager.UnregisterHotkey(_hotkeyHandle);
|
||||
}
|
||||
_hotkeyManager.Dispose();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user