Commit 1f7c5096 authored by Jürg Billeter's avatar Jürg Billeter

libtracker-sparql-backend: Fix memory leak in Connection.get

The leak was caused by a bug in valac (fixed in master). This changes
the code to work correctly with valac versions without the fix as well.

Fixes NB#250455.
parent 006625d8
......@@ -198,25 +198,24 @@ class Tracker.Sparql.Backend : Connection {
try {
// assign to owned variable to ensure it doesn't get freed between check and return
var result = singleton;
if (result != null) {
assert (direct_only == is_direct_only);
return result;
}
log_init ();
if (result == null) {
log_init ();
direct_only = is_direct_only;
direct_only = is_direct_only;
result = new Tracker.Sparql.Backend ();
result = new Tracker.Sparql.Backend ();
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
if (cancellable != null && cancellable.is_cancelled ()) {
throw new IOError.CANCELLED ("Operation was cancelled");
}
singleton = result;
result.add_weak_pointer ((void**) (&singleton));
singleton = result;
result.add_weak_pointer ((void**) (&singleton));
}
return singleton;
assert (direct_only == is_direct_only);
return result;
} finally {
door.unlock ();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment