mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[Run-Plugin][Program] Fix null reference exception on Dispose (#11785)
This commit is contained in:
@@ -171,7 +171,11 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_context.API.ThemeChanged -= OnThemeChanged;
|
if (_context != null && _context.API != null)
|
||||||
|
{
|
||||||
|
_context.API.ThemeChanged -= OnThemeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,11 @@ namespace Microsoft.Plugin.Folder
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_context.API.ThemeChanged -= OnThemeChanged;
|
if (_context != null && _context.API != null)
|
||||||
|
{
|
||||||
|
_context.API.ThemeChanged -= OnThemeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,8 +210,12 @@ namespace Microsoft.Plugin.Program
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_context.API.ThemeChanged -= OnThemeChanged;
|
if (_context != null && _context.API != null)
|
||||||
_win32ProgramRepositoryHelper.Dispose();
|
{
|
||||||
|
_context.API.ThemeChanged -= OnThemeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
_win32ProgramRepositoryHelper?.Dispose();
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,11 @@ namespace Microsoft.Plugin.Uri
|
|||||||
{
|
{
|
||||||
if (!_disposed && disposing)
|
if (!_disposed && disposing)
|
||||||
{
|
{
|
||||||
Context.API.ThemeChanged -= OnThemeChanged;
|
if (Context != null && Context.API != null)
|
||||||
|
{
|
||||||
|
Context.API.ThemeChanged -= OnThemeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,11 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
Context.API.ThemeChanged -= OnThemeChanged;
|
if (Context != null && Context.API != null)
|
||||||
|
{
|
||||||
|
Context.API.ThemeChanged -= OnThemeChanged;
|
||||||
|
}
|
||||||
|
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(_context is null))
|
if (_context != null && _context.API != null)
|
||||||
{
|
{
|
||||||
_context.API.ThemeChanged -= OnThemeChanged;
|
_context.API.ThemeChanged -= OnThemeChanged;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(_context is null))
|
if (_context != null && _context.API != null)
|
||||||
{
|
{
|
||||||
_context.API.ThemeChanged -= OnThemeChanged;
|
_context.API.ThemeChanged -= OnThemeChanged;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user