[geary/wip/search-crash-720703] Copy array manually to work around vala bug
- From: Charles Lindsay <clindsay src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/search-crash-720703] Copy array manually to work around vala bug
- Date: Sat, 4 Jan 2014 01:01:40 +0000 (UTC)
commit 8f6732e6626e1b8933d78779901386edaf7547e3
Author: Charles Lindsay <chaz yorba org>
Date: Fri Jan 3 17:00:49 2014 -0800
Copy array manually to work around vala bug
src/engine/imap-db/imap-db-account.vala | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/engine/imap-db/imap-db-account.vala b/src/engine/imap-db/imap-db-account.vala
index 3c0407f..e9f8dcb 100644
--- a/src/engine/imap-db/imap-db-account.vala
+++ b/src/engine/imap-db/imap-db-account.vala
@@ -746,8 +746,17 @@ private class Geary.ImapDB.Account : BaseObject {
foreach (string? field in query.get_fields()) {
string? phrase = null;
Gee.List<string>? tokens = query.get_tokens(field);
- if (tokens != null)
- phrase = string.joinv(" ", tokens.to_array()).strip();
+ if (tokens != null) {
+ string[] array = tokens.to_array();
+ // HACK: work around a bug in vala where it's not null-terminating
+ // arrays created from generic-typed functions (Gee.Collection.to_array)
+ // before passing them off to g_strjoinv. Simply making a copy to a
+ // local proper string array adds the null for us.
+ string[] copy = new string[array.length];
+ for (int i = 0; i < array.length; ++i)
+ copy[i] = array[i];
+ phrase = string.joinv(" ", copy).strip();
+ }
if (!Geary.String.is_empty(phrase))
phrases.set((field == null ? "MessageSearchTable" : field), phrase);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]