[tracker] tracker-needle: Fixed crash for null cursor and calling next() on it
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-needle: Fixed crash for null cursor and calling next() on it
- Date: Wed, 8 Jun 2011 13:38:59 +0000 (UTC)
commit e79418319bcf7adaa73861cd9b16dd4d68571d27
Author: Martyn Russell <martyn lanedo com>
Date: Wed Jun 8 14:25:50 2011 +0100
tracker-needle: Fixed crash for null cursor and calling next() on it
src/tracker-needle/tracker-result-store.vala | 64 +++++++++++++------------
1 files changed, 33 insertions(+), 31 deletions(-)
---
diff --git a/src/tracker-needle/tracker-result-store.vala b/src/tracker-needle/tracker-result-store.vala
index e1f4b13..4c1f15a 100644
--- a/src/tracker-needle/tracker-result-store.vala
+++ b/src/tracker-needle/tracker-result-store.vala
@@ -94,43 +94,45 @@ public class Tracker.ResultStore : Gtk.TreeModel, GLib.Object {
cancellable.set_error_if_cancelled ();
- for (i = op.offset; i < op.offset + 100; i++) {
- ResultNode *result;
- TreeIter iter;
- TreePath path;
- bool b = false;
- int j;
-
- try {
- b = yield cursor.next_async (cancellable);
- } catch (GLib.Error ge) {
- warning ("Could not fetch row: %s\n", ge.message);
- }
+ if (cursor != null) {
+ for (i = op.offset; i < op.offset + 100; i++) {
+ ResultNode *result;
+ TreeIter iter;
+ TreePath path;
+ bool b = false;
+ int j;
+
+ try {
+ b = yield cursor.next_async (cancellable);
+ } catch (GLib.Error ge) {
+ warning ("Could not fetch row: %s\n", ge.message);
+ }
- if (!b) {
- break;
- }
+ if (!b) {
+ break;
+ }
- result = &op.node.results[i];
+ result = &op.node.results[i];
- for (j = 0; j < n_columns; j++) {
- if (j == n_columns - 1) {
- // FIXME: Set markup for tooltip column in a nicer way
- result.values[j] = Markup.escape_text (cursor.get_string (j));
- } else {
- result.values[j] = cursor.get_string (j);
+ for (j = 0; j < n_columns; j++) {
+ if (j == n_columns - 1) {
+ // FIXME: Set markup for tooltip column in a nicer way
+ result.values[j] = Markup.escape_text (cursor.get_string (j));
+ } else {
+ result.values[j] = cursor.get_string (j);
+ }
}
- }
- // Emit row-changed
- iter = TreeIter ();
- iter.stamp = this.timestamp;
- iter.user_data = op.node;
- iter.user_data2 = result;
- iter.user_data3 = i.to_pointer ();
+ // Emit row-changed
+ iter = TreeIter ();
+ iter.stamp = this.timestamp;
+ iter.user_data = op.node;
+ iter.user_data2 = result;
+ iter.user_data3 = i.to_pointer ();
- path = this.get_path (iter);
- row_changed (path, iter);
+ path = this.get_path (iter);
+ row_changed (path, iter);
+ }
}
running_operations.remove (op);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]