[tracker] libtracker-direct: Fix use_count on failed initialization
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-direct: Fix use_count on failed initialization
- Date: Fri, 3 Jun 2011 13:57:04 +0000 (UTC)
commit 6786b384aa50a21aadc4eaca22061bcff012e572
Author: Jürg Billeter <j bitron ch>
Date: Fri Jun 3 15:46:12 2011 +0200
libtracker-direct: Fix use_count on failed initialization
src/libtracker-direct/tracker-direct.vala | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-direct/tracker-direct.vala b/src/libtracker-direct/tracker-direct.vala
index 3ad7dce..55ed05e 100644
--- a/src/libtracker-direct/tracker-direct.vala
+++ b/src/libtracker-direct/tracker-direct.vala
@@ -19,6 +19,7 @@
public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
static int use_count;
+ bool initialized;
public Connection () throws Sparql.Error, IOError, DBusError {
DBManager.lock ();
@@ -36,6 +37,7 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
}
use_count++;
+ initialized = true;
} catch (Error e) {
throw new Sparql.Error.INTERNAL (e.message);
} finally {
@@ -44,6 +46,11 @@ public class Tracker.Direct.Connection : Tracker.Sparql.Connection {
}
~Connection () {
+ if (!initialized) {
+ // use_count did not get increased if initialization failed
+ return;
+ }
+
// Clean up connection
DBManager.lock ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]