mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
don't allow image processing after disposing
This commit is contained in:
parent
fce2c95ac7
commit
3788033dcd
@ -202,6 +202,8 @@ namespace MediaBrowser.Server.Implementations.Drawing
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CheckDisposed();
|
||||||
|
|
||||||
var newWidth = Convert.ToInt32(newSize.Width);
|
var newWidth = Convert.ToInt32(newSize.Width);
|
||||||
var newHeight = Convert.ToInt32(newSize.Height);
|
var newHeight = Convert.ToInt32(newSize.Height);
|
||||||
|
|
||||||
@ -448,6 +450,7 @@ namespace MediaBrowser.Server.Implementations.Drawing
|
|||||||
/// <returns>ImageSize.</returns>
|
/// <returns>ImageSize.</returns>
|
||||||
private ImageSize GetImageSizeInternal(string path)
|
private ImageSize GetImageSizeInternal(string path)
|
||||||
{
|
{
|
||||||
|
CheckDisposed();
|
||||||
var size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
|
var size = ImageHeader.GetDimensions(path, _logger, _fileSystem);
|
||||||
|
|
||||||
StartSaveImageSizeTimer();
|
StartSaveImageSizeTimer();
|
||||||
@ -793,10 +796,20 @@ namespace MediaBrowser.Server.Implementations.Drawing
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _disposed;
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
_disposed = true;
|
||||||
Wand.CloseEnvironment();
|
Wand.CloseEnvironment();
|
||||||
_saveImageSizeTimer.Dispose();
|
_saveImageSizeTimer.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckDisposed()
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user