Skip to content

Commit 179eaaa

Browse files
committed
v2.6.5
fix bug: timerReport is not null checked before calling it to stop during dispose added new winforms demo
1 parent 4b967f1 commit 179eaaa

26 files changed

+2852
-101
lines changed

source code/MySqlBackup(Devart-Express)/MySqlBackup.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,7 +2705,7 @@ public void StopAllProcess()
27052705
{
27062706
stopProcess = true;
27072707
Command?.Cancel();
2708-
timerReport.Stop();
2708+
timerReport?.Stop();
27092709

27102710
// Signal BlockingCollections to stop
27112711
try
@@ -2728,7 +2728,7 @@ public void Dispose()
27282728
// Wait for tasks to complete with timeout
27292729
try
27302730
{
2731-
if (_phase1Task != null || _phase2Task != null || _phase3Task != null)
2731+
if (_phase1Task != null || _phase2Task != null || _phase3Task != null || _importPhase1Task != null || _importPhase2Task != null)
27322732
{
27332733
var tasks = new List<Task>();
27342734
if (_phase1Task != null) tasks.Add(_phase1Task);
@@ -2769,36 +2769,5 @@ public void Dispose()
27692769
textReader = null;
27702770
}
27712771
}
2772-
2773-
//public void StopAllProcess()
2774-
//{
2775-
// stopProcess = true;
2776-
// Command?.Cancel();
2777-
// timerReport.Stop();
2778-
//}
2779-
2780-
//public void Dispose()
2781-
//{
2782-
// StopAllProcess();
2783-
2784-
// if (timerReport != null)
2785-
// {
2786-
// timerReport.Stop();
2787-
// timerReport.Dispose();
2788-
// timerReport = null;
2789-
// }
2790-
2791-
// if (textWriter != null)
2792-
// {
2793-
// textWriter.Dispose();
2794-
// textWriter = null;
2795-
// }
2796-
2797-
// if (textReader != null)
2798-
// {
2799-
// textReader.Dispose();
2800-
// textReader = null;
2801-
// }
2802-
//}
28032772
}
28042773
}

source code/MySqlBackup(MySql.Data)/MySqlBackup.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ public void StopAllProcess()
27062706
{
27072707
stopProcess = true;
27082708
Command?.Cancel();
2709-
timerReport.Stop();
2709+
timerReport?.Stop();
27102710

27112711
// Signal BlockingCollections to stop
27122712
try
@@ -2729,7 +2729,7 @@ public void Dispose()
27292729
// Wait for tasks to complete with timeout
27302730
try
27312731
{
2732-
if (_phase1Task != null || _phase2Task != null || _phase3Task != null)
2732+
if (_phase1Task != null || _phase2Task != null || _phase3Task != null || _importPhase1Task != null || _importPhase2Task != null)
27332733
{
27342734
var tasks = new List<Task>();
27352735
if (_phase1Task != null) tasks.Add(_phase1Task);
@@ -2770,36 +2770,5 @@ public void Dispose()
27702770
textReader = null;
27712771
}
27722772
}
2773-
2774-
//public void StopAllProcess()
2775-
//{
2776-
// stopProcess = true;
2777-
// Command?.Cancel();
2778-
// timerReport.Stop();
2779-
//}
2780-
2781-
//public void Dispose()
2782-
//{
2783-
// StopAllProcess();
2784-
2785-
// if (timerReport != null)
2786-
// {
2787-
// timerReport.Stop();
2788-
// timerReport.Dispose();
2789-
// timerReport = null;
2790-
// }
2791-
2792-
// if (textWriter != null)
2793-
// {
2794-
// textWriter.Dispose();
2795-
// textWriter = null;
2796-
// }
2797-
2798-
// if (textReader != null)
2799-
// {
2800-
// textReader.Dispose();
2801-
// textReader = null;
2802-
// }
2803-
//}
28042773
}
28052774
}

source code/MySqlBackup(MySqlConnector)/MySqlBackup.cs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,7 +2705,7 @@ public void StopAllProcess()
27052705
{
27062706
stopProcess = true;
27072707
Command?.Cancel();
2708-
timerReport.Stop();
2708+
timerReport?.Stop();
27092709

27102710
// Signal BlockingCollections to stop
27112711
try
@@ -2728,7 +2728,7 @@ public void Dispose()
27282728
// Wait for tasks to complete with timeout
27292729
try
27302730
{
2731-
if (_phase1Task != null || _phase2Task != null || _phase3Task != null)
2731+
if (_phase1Task != null || _phase2Task != null || _phase3Task != null || _importPhase1Task != null || _importPhase2Task != null)
27322732
{
27332733
var tasks = new List<Task>();
27342734
if (_phase1Task != null) tasks.Add(_phase1Task);
@@ -2769,36 +2769,5 @@ public void Dispose()
27692769
textReader = null;
27702770
}
27712771
}
2772-
2773-
//public void StopAllProcess()
2774-
//{
2775-
// stopProcess = true;
2776-
// Command?.Cancel();
2777-
// timerReport.Stop();
2778-
//}
2779-
2780-
//public void Dispose()
2781-
//{
2782-
// StopAllProcess();
2783-
2784-
// if (timerReport != null)
2785-
// {
2786-
// timerReport.Stop();
2787-
// timerReport.Dispose();
2788-
// timerReport = null;
2789-
// }
2790-
2791-
// if (textWriter != null)
2792-
// {
2793-
// textWriter.Dispose();
2794-
// textWriter = null;
2795-
// }
2796-
2797-
// if (textReader != null)
2798-
// {
2799-
// textReader.Dispose();
2800-
// textReader = null;
2801-
// }
2802-
//}
28032772
}
28042773
}

source code/MySqlBackup.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySqlBackup(Devart-Express)
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySqlBackup(MySql.Data)", "MySqlBackup(MySql.Data)\MySqlBackup(MySql.Data).csproj", "{D2D668B6-0937-4497-9492-249553AB2A94}"
1717
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsDemo", "WinFormsDemo\WinFormsDemo.csproj", "{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}"
19+
EndProject
1820
Global
1921
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2022
Debug|Any CPU = Debug|Any CPU
@@ -71,6 +73,14 @@ Global
7173
{D2D668B6-0937-4497-9492-249553AB2A94}.Release|Any CPU.Build.0 = Release|Any CPU
7274
{D2D668B6-0937-4497-9492-249553AB2A94}.ReleaseNET40_Only|Any CPU.ActiveCfg = Release|Any CPU
7375
{D2D668B6-0937-4497-9492-249553AB2A94}.ReleaseNET40_Only|Any CPU.Build.0 = Release|Any CPU
76+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.Debug|Any CPU.Build.0 = Debug|Any CPU
78+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.NET20|Any CPU.ActiveCfg = Debug|Any CPU
79+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.NET20|Any CPU.Build.0 = Debug|Any CPU
80+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.Release|Any CPU.ActiveCfg = Release|Any CPU
81+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.ReleaseNET40_Only|Any CPU.ActiveCfg = Release|Any CPU
83+
{3524FA2C-EA2B-4B3E-88B6-B5F240D5014A}.ReleaseNET40_Only|Any CPU.Build.0 = Release|Any CPU
7484
EndGlobalSection
7585
GlobalSection(SolutionProperties) = preSolution
7686
HideSolutionNode = FALSE

source code/TestDebugASPNET/MySqlBackup.NET/MySqlBackup_v2.6.2_ParallelImport.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,7 +2705,7 @@ public void StopAllProcess()
27052705
{
27062706
stopProcess = true;
27072707
Command?.Cancel();
2708-
timerReport.Stop();
2708+
timerReport?.Stop();
27092709

27102710
// Signal BlockingCollections to stop
27112711
try
@@ -2742,9 +2742,10 @@ public void Dispose()
27422742
}
27432743
catch
27442744
{
2745-
2745+
// Ignore timeout exceptions
27462746
}
27472747

2748+
// Dispose BlockingCollections
27482749
_rowDataCollection?.Dispose();
27492750
_sqlStatementCollection?.Dispose();
27502751
_importQueryCollection?.Dispose();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
<runtime>
7+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
8+
<dependentAssembly>
9+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
10+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
11+
</dependentAssembly>
12+
</assemblyBinding>
13+
</runtime>
14+
</configuration>

source code/WinFormsDemo/Form1Menu.Designer.cs

Lines changed: 87 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
11+
namespace WinFormsDemo
12+
{
13+
public partial class Form1Menu : baseForm
14+
{
15+
public Form1Menu()
16+
{
17+
InitializeComponent();
18+
}
19+
20+
private void button_SimpleDemo_Click(object sender, EventArgs e)
21+
{
22+
FormSimpleDemo f = new FormSimpleDemo();
23+
f.Show();
24+
}
25+
26+
private void button_progress_report_Click(object sender, EventArgs e)
27+
{
28+
FormProgressReport f = new FormProgressReport();
29+
f.Show();
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)