mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Cache connection and clear pool after all operations to avoid ObjectDisposedException
This commit is contained in:
parent
2a4b4de3ef
commit
c8e82cbd09
2 changed files with 22 additions and 4 deletions
|
|
@ -155,6 +155,9 @@ public abstract class ChromiumBookmarkLoader : IBookmarkLoader
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cache connection for pool clean
|
||||||
|
SqliteConnection connection1 = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
|
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
|
||||||
|
|
@ -216,8 +219,9 @@ public abstract class ChromiumBookmarkLoader : IBookmarkLoader
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// https://github.com/dotnet/efcore/issues/26580
|
// Cache connection and clear pool after all operations to avoid issue:
|
||||||
SqliteConnection.ClearPool(connection);
|
// ObjectDisposedException: Safe handle has been closed.
|
||||||
|
connection1 = connection;
|
||||||
connection.Close();
|
connection.Close();
|
||||||
connection.Dispose();
|
connection.Dispose();
|
||||||
}
|
}
|
||||||
|
|
@ -231,6 +235,11 @@ public abstract class ChromiumBookmarkLoader : IBookmarkLoader
|
||||||
// Delete temporary file
|
// Delete temporary file
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// https://github.com/dotnet/efcore/issues/26580
|
||||||
|
if (connection1 != null)
|
||||||
|
{
|
||||||
|
SqliteConnection.ClearPool(connection1);
|
||||||
|
}
|
||||||
File.Delete(tempDbPath);
|
File.Delete(tempDbPath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,9 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cache connection for pool clean
|
||||||
|
SqliteConnection connection1 = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
|
// Since some bookmarks may have same favicon id, we need to record them to avoid duplicates
|
||||||
|
|
@ -212,8 +215,9 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// https://github.com/dotnet/efcore/issues/26580
|
// Cache connection and clear pool after all operations to avoid issue:
|
||||||
SqliteConnection.ClearPool(connection);
|
// ObjectDisposedException: Safe handle has been closed.
|
||||||
|
connection1 = connection;
|
||||||
connection.Close();
|
connection.Close();
|
||||||
connection.Dispose();
|
connection.Dispose();
|
||||||
}
|
}
|
||||||
|
|
@ -227,6 +231,11 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
||||||
// Delete temporary file
|
// Delete temporary file
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// https://github.com/dotnet/efcore/issues/26580
|
||||||
|
if (connection1 != null)
|
||||||
|
{
|
||||||
|
SqliteConnection.ClearPool(connection1);
|
||||||
|
}
|
||||||
File.Delete(tempDbPath);
|
File.Delete(tempDbPath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue