#At file:///H:/connector_net/6.2/ based on revid:vvaintroub@strippede3ag0
854 Vladislav Vaintroub 2010-06-10
Bug #53457 : try to avoid exceptions if connection is closed by GC
modified:
CHANGES
MySql.Data/Provider/Source/Driver.cs
MySql.Data/Provider/Source/ResultSet.cs
MySql.Data/Provider/Source/command.cs
MySql.VisualStudio/MySql.VisualStudio.csproj
=== modified file 'CHANGES'
--- a/CHANGES 2010-06-10 17:49:05 +0000
+++ b/CHANGES 2010-06-10 19:25:08 +0000
@@ -1,3 +1,4 @@
+- Try to avoid exception when Connection is closed by garbage collector (bug #53457)
- Added trace message in exception blog in MySqlConnection.Abort() method (bug #52769)
- changed mapping of latin1 from latin1 to windows-1252 (bug #51927)
- flushed out many more entires in error code enum (bug #51988)
=== modified file 'MySql.Data/Provider/Source/Driver.cs'
--- a/MySql.Data/Provider/Source/Driver.cs 2009-12-16 00:32:52 +0000
+++ b/MySql.Data/Provider/Source/Driver.cs 2010-06-10 19:25:08 +0000
@@ -80,7 +80,7 @@ namespace MySql.Data.MySqlClient
~Driver()
{
- Close();
+ Dispose(false);
}
#region Properties
@@ -461,14 +461,25 @@ namespace MySql.Data.MySqlClient
protected virtual void Dispose(bool disposing)
{
- ResetTimeout(1000);
- if (disposing)
- handler.Close(isOpen);
- // if we are pooling, then release ourselves
- if (connectionString.Pooling)
- MySqlPoolManager.RemoveConnection(this);
-
- isOpen = false;
+ try
+ {
+ ResetTimeout(1000);
+ if (disposing)
+ handler.Close(isOpen);
+ // if we are pooling, then release ourselves
+ if (connectionString.Pooling)
+ MySqlPoolManager.RemoveConnection(this);
+ }
+ catch (Exception)
+ {
+ if (disposing)
+ throw;
+ }
+ finally
+ {
+ reader = null;
+ isOpen = false;
+ }
}
public void Dispose()
=== modified file 'MySql.Data/Provider/Source/ResultSet.cs'
--- a/MySql.Data/Provider/Source/ResultSet.cs 2010-06-10 17:49:05 +0000
+++ b/MySql.Data/Provider/Source/ResultSet.cs 2010-06-10 19:25:08 +0000
@@ -222,10 +222,18 @@ namespace MySql.Data.MySqlClient
// if we have rows but the user didn't read the first one then mark it as skipped
if (HasRows && rowIndex == -1)
skippedRows++;
- while (driver.SkipDataRow())
+ try
{
- totalRows++;
- skippedRows++;
+ while (driver.IsOpen && driver.SkipDataRow())
+ {
+ totalRows++;
+ skippedRows++;
+ }
+ }
+ catch (System.IO.IOException)
+ {
+ // it is ok to eat IO exceptions here, we just want to
+ // close the result set
}
readDone = true;
}
=== modified file 'MySql.Data/Provider/Source/command.cs'
--- a/MySql.Data/Provider/Source/command.cs 2010-06-10 18:59:44 +0000
+++ b/MySql.Data/Provider/Source/command.cs 2010-06-10 19:25:08 +0000
@@ -323,7 +323,8 @@ namespace MySql.Data.MySqlClient
if (statement != null)
statement.Close(reader);
ResetSqlSelectLimit();
- connection.driver.CloseQuery(connection, statement.StatementId);
+ if (statement != null)
+ connection.driver.CloseQuery(connection, statement.StatementId);
ClearCommandTimer();
}
=== modified file 'MySql.VisualStudio/MySql.VisualStudio.csproj'
--- a/MySql.VisualStudio/MySql.VisualStudio.csproj 2009-11-12 12:42:13 +0000
+++ b/MySql.VisualStudio/MySql.VisualStudio.csproj 2010-06-10 19:25:08 +0000
@@ -130,13 +130,11 @@ <Project DefaultTargets="Build" xmlns
<Compile Include="DDEX\MySqlConnectionProperties.cs" />
<Compile Include="DDEX\MySqlConnectionSupport.cs" />
<Compile Include="DDEX\MySqlConnectionUIControl.cs">
- <SubType>UserControl</SubType>
</Compile>
<Compile Include="DDEX\MySqlConnectionUIControl.designer.cs">
<DependentUpon>MySqlConnectionUIControl.cs</DependentUpon>
</Compile>
<Compile Include="DDEX\MySqlDataConnectionPromptDialog.cs">
- <SubType>Form</SubType>
</Compile>
<Compile Include="DDEX\MySqlDataConnectionPromptDialog.Designer.cs">
<DependentUpon>MySqlDataConnectionPromptDialog.cs</DependentUpon>
Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20100610192508-9sijyfzan3x2ofpl.bundle
Thread |
---|
• bzr commit into connector-net-6.2 branch (vvaintroub:854) Bug#53457 | Vladislav Vaintroub | 10 Jun |