summaryrefslogtreecommitdiff
path: root/gnome-unstable/epiphany/fix-infinite-loop
blob: 7322a0a4c06efb3d65293664dea848f9b3747d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 087cb32d81fd8ef1cf3f493fce9e80e7217dbf04 Mon Sep 17 00:00:00 2001
From: Xan Lopez <xan@igalia.com>
Date: Wed, 21 Mar 2012 14:41:36 +0100
Subject: [PATCH] profile-migrator: do not freak out if the history is empty

If the old history file exists but has no actual visits we'll enter
into an infinite loop.

https://bugzilla.gnome.org/show_bug.cgi?id=672547
---
 lib/ephy-profile-migrator.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index f7a3406..a37638c 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -594,11 +594,13 @@ migrate_history ()
   g_input_stream_close (G_INPUT_STREAM (input), NULL, NULL);
   g_object_unref (input);
 
-  ephy_history_service_add_visits (history_service, parse_data.visits, NULL, (EphyHistoryJobCallback)visit_cb, NULL);
-  ephy_history_page_visit_list_free (parse_data.visits);
+  if (parse_data.visits) {
+    ephy_history_service_add_visits (history_service, parse_data.visits, NULL, (EphyHistoryJobCallback)visit_cb, NULL);
+    ephy_history_page_visit_list_free (parse_data.visits);
 
-  while (!all_done)
-    g_main_context_iteration (NULL, FALSE);
+    while (!all_done)
+      g_main_context_iteration (NULL, FALSE);
+  }
 
   g_object_unref (history_service);
 }
-- 
1.7.7.6