diff -Nru zeitgeist-0.9.14/debian/changelog zeitgeist-0.9.14/debian/changelog
--- zeitgeist-0.9.14/debian/changelog	2014-06-23 11:49:26.000000000 +0100
+++ zeitgeist-0.9.14/debian/changelog	2014-06-24 18:07:28.000000000 +0100
@@ -1,3 +1,13 @@
+zeitgeist (0.9.14-2.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * 0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch:
+    Cherry-pick commit to fix SQL errors when built with vala-0.24.
+  * 0001-Fix-unit-tests.patch: Cherry-pick another patch to fix a segfault
+    when optimising variants. (Closes: #752482)
+
+ -- Iain Lane <laney@debian.org>  Tue, 24 Jun 2014 18:07:28 +0100
+
 zeitgeist (0.9.14-2.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru zeitgeist-0.9.14/debian/patches/0001-Fix-unit-tests.patch zeitgeist-0.9.14/debian/patches/0001-Fix-unit-tests.patch
--- zeitgeist-0.9.14/debian/patches/0001-Fix-unit-tests.patch	1970-01-01 01:00:00.000000000 +0100
+++ zeitgeist-0.9.14/debian/patches/0001-Fix-unit-tests.patch	2014-06-24 17:45:09.000000000 +0100
@@ -0,0 +1,60 @@
+From 42f0f6b0f17a584b703981b8a392c3225c7a8e98 Mon Sep 17 00:00:00 2001
+From: Seif Lotfy <seif@lotfy.com>
+Date: Thu, 2 Jan 2014 08:09:01 +0100
+Subject: [PATCH] Fix unit-tests
+
+Currently the unit tests failed when loading the xdg directories
+and also it seems like optimizing the event variant lead to a
+segfault when converting back via from_variant with several events
+---
+ libzeitgeist/event.vala  | 4 ++--
+ test/c/test-datasource.c | 3 +--
+ test/c/test-event.c      | 3 +--
+ 3 files changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/libzeitgeist/event.vala b/libzeitgeist/event.vala
+index 67fe47f..0cd708c 100644
+--- a/libzeitgeist/event.vala
++++ b/libzeitgeist/event.vala
+@@ -292,8 +292,8 @@ public class Event : Object
+         }
+ 
+         Variant event_variant = vb.end ().get_normal_form ();
+-        Variant ret = optimize_variant_allocation (event_variant);
+-        return ret;
++        //Variant ret = optimize_variant_allocation (event_variant);
++        return event_variant;
+     }
+ 
+     private Variant optimize_variant_allocation (Variant event_variant) {
+diff --git a/test/c/test-datasource.c b/test/c/test-datasource.c
+index a60d48b..067da55 100644
+--- a/test/c/test-datasource.c
++++ b/test/c/test-datasource.c
+@@ -35,8 +35,7 @@ static const gchar *old_xdg_data_dirs = NULL;
+ static void
+ setup (Fixture *fix, gconstpointer data)
+ {
+-  if (old_xdg_data_dirs != NULL)
+-    old_xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
++  old_xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
+   g_setenv ("XDG_DATA_DIRS", TEST_DIR, TRUE);
+ }
+ 
+diff --git a/test/c/test-event.c b/test/c/test-event.c
+index 746de3d..440d3c3 100644
+--- a/test/c/test-event.c
++++ b/test/c/test-event.c
+@@ -35,8 +35,7 @@ static const gchar *old_xdg_data_dirs = NULL;
+ static void
+ setup (Fixture *fix, gconstpointer data)
+ {
+-  if (old_xdg_data_dirs != NULL)
+-    old_xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
++  old_xdg_data_dirs = g_getenv ("XDG_DATA_DIRS");
+   g_setenv ("XDG_DATA_DIRS", TEST_DIR, TRUE);
+ }
+ 
+-- 
+2.0.0
+
diff -Nru zeitgeist-0.9.14/debian/patches/0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch zeitgeist-0.9.14/debian/patches/0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch
--- zeitgeist-0.9.14/debian/patches/0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch	1970-01-01 01:00:00.000000000 +0100
+++ zeitgeist-0.9.14/debian/patches/0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch	2014-06-24 14:31:25.000000000 +0100
@@ -0,0 +1,29 @@
+From 201bd67de450320520a12e2b0c465c8eb6818bd2 Mon Sep 17 00:00:00 2001
+From: Rico Tzschichholz <ricotz@ubuntu.com>
+Date: Mon, 17 Mar 2014 20:57:49 +0100
+Subject: [PATCH] WhereClause: Fix array-length to work with string.joinv of
+ vala-0.24
+
+---
+ libzeitgeist/where-clause.vala | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libzeitgeist/where-clause.vala b/libzeitgeist/where-clause.vala
+index a830599..d981914 100644
+--- a/libzeitgeist/where-clause.vala
++++ b/libzeitgeist/where-clause.vala
+@@ -211,7 +211,11 @@ namespace Zeitgeist
+          */
+         private T[] generic_array_to_unowned_array<T> (GenericArray<T> gptrarr)
+         {
++#if VALA_0_24
++            long[] pointers = new long[gptrarr.length];
++#else
+             long[] pointers = new long[gptrarr.length + 1];
++#endif
+             Memory.copy(pointers, ((PtrArray *) gptrarr)->pdata,
+                 (gptrarr.length) * sizeof (void *));
+             return (T[]) pointers;
+-- 
+2.0.0
+
diff -Nru zeitgeist-0.9.14/debian/patches/series zeitgeist-0.9.14/debian/patches/series
--- zeitgeist-0.9.14/debian/patches/series	2014-06-23 11:46:00.000000000 +0100
+++ zeitgeist-0.9.14/debian/patches/series	2014-06-24 17:45:09.000000000 +0100
@@ -1,2 +1,4 @@
 fix_autocomplete.diff
 0001-libzeitgeist-Add-a-missing-dependency-on-gio-2.0.patch
+0001-WhereClause-Fix-array-length-to-work-with-string.joi.patch
+0001-Fix-unit-tests.patch
