mirror of
https://github.com/soukoku/ntwain.git
synced 2026-01-01 07:48:07 +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)
|
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
if (_twain != null)
|
||||||
{
|
{
|
||||||
if (e.CloseReason == CloseReason.UserClosing && _twain.State > 4)
|
if (e.CloseReason == CloseReason.UserClosing && _twain.State > 4)
|
||||||
{
|
{
|
||||||
@@ -49,6 +51,7 @@ namespace Tester.Winform
|
|||||||
{
|
{
|
||||||
CleanupTwain();
|
CleanupTwain();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
base.OnFormClosing(e);
|
base.OnFormClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,8 +107,6 @@ namespace Tester.Winform
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void CleanupTwain()
|
private void CleanupTwain()
|
||||||
{
|
|
||||||
if (_twain != null)
|
|
||||||
{
|
{
|
||||||
if (_twain.State == 4)
|
if (_twain.State == 4)
|
||||||
{
|
{
|
||||||
@@ -122,7 +123,6 @@ namespace Tester.Winform
|
|||||||
_twain.ForceStepDown(2);
|
_twain.ForceStepDown(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user