mirror of
https://github.com/soukoku/ntwain.git
synced 2025-10-26 03:32:00 +08:00
tester crashes on close if twain not initialized.
This commit is contained in:
@@ -40,6 +40,8 @@ namespace Tester.Winform
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
if (_twain != null)
|
||||
{
|
||||
if (e.CloseReason == CloseReason.UserClosing && _twain.State > 4)
|
||||
{
|
||||
@@ -49,6 +51,7 @@ namespace Tester.Winform
|
||||
{
|
||||
CleanupTwain();
|
||||
}
|
||||
}
|
||||
base.OnFormClosing(e);
|
||||
}
|
||||
|
||||
@@ -104,8 +107,6 @@ namespace Tester.Winform
|
||||
}
|
||||
|
||||
private void CleanupTwain()
|
||||
{
|
||||
if (_twain != null)
|
||||
{
|
||||
if (_twain.State == 4)
|
||||
{
|
||||
@@ -122,7 +123,6 @@ namespace Tester.Winform
|
||||
_twain.ForceStepDown(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user