On Sun, 2013-09-29 at 21:34 +0200, Tino Keitel wrote:
> On Sat, Sep 28, 2013 at 20:00:07 +0200, Patrick Ohly wrote:
> 
> [...]
> 
> > Let's backtrace a bit. What steps are necessary to make it crash without
> > valgrind?
> 
> I just click on "Sync now" in sync-ui. It segfaults, and if I restart
> it as long as the sync is running, it segfaults again without any
> further GUI action by the user.

Could it be that no service is selected while running that sync? I was
able to reproduce such a crash in find_updated_source_progress(). Patch
attached.

But that doesn't match your initial stack backtrace at all. Are you
compiling with GTK-2 or GTK-3? If the crash persists, can you recompile
without optimization and capture another stack backtrace?

> I use the current Debian sid and the packages from
> http://tikei.de/syncevolution-1.3.2/

The crash is independent of the specific version. This has been broken
for a long time.

> > And those same steps do not cause it to crash when running under
> > valgrind?
> 
> Yes.

Really strange. Perhaps it changes timing so that the method never gets
invoked because the sync completes too quickly.


-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From e856f59927161bf43699879e622a29970e19045c Mon Sep 17 00:00:00 2001
From: Patrick Ohly <[email protected]>
Date: Mon, 30 Sep 2013 15:14:44 +0200
Subject: [PATCH] GTK/GTK3 UI: fix crash when a sync runs while no service is
 selected

Running a sync while the UI had no service selected caused a crash in
find_updated_source_progress() because the code dereferences the NULL
prog_data->data->current_service pointer. Affected both the GTK2 and
GTK3 UI.

Fix it by checking for NULL and not doing anything if NULL.
---
 src/gtk-ui/sync-ui.c  |    4 ++--
 src/gtk3-ui/sync-ui.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gtk-ui/sync-ui.c b/src/gtk-ui/sync-ui.c
index 7c249f2..11da45d 100644
--- a/src/gtk-ui/sync-ui.c
+++ b/src/gtk-ui/sync-ui.c
@@ -2476,9 +2476,9 @@ find_updated_source_progress (const char *name,
                               SyncevoSourcePhase phase,
                               source_progress_data *prog_data)
 {
-    GHashTable *configs = prog_data->data->current_service->source_configs;
+    GHashTable *configs = prog_data->data->current_service ? prog_data->data->current_service->source_configs : NULL;
     source_config *config;
-    config = g_hash_table_lookup (configs, name);
+    config = configs ? g_hash_table_lookup (configs, name) : NULL;
     if (config) {
         if (phase != config->phase) {
             config->phase = phase;
diff --git a/src/gtk3-ui/sync-ui.c b/src/gtk3-ui/sync-ui.c
index a1cbf2c..1d83eb2 100644
--- a/src/gtk3-ui/sync-ui.c
+++ b/src/gtk3-ui/sync-ui.c
@@ -2444,9 +2444,9 @@ find_updated_source_progress (const char *name,
                               SyncevoSourcePhase phase,
                               source_progress_data *prog_data)
 {
-    GHashTable *configs = prog_data->data->current_service->source_configs;
+    GHashTable *configs = prog_data->data->current_service ? prog_data->data->current_service->source_configs : NULL;
     source_config *config;
-    config = g_hash_table_lookup (configs, name);
+    config = configs ? g_hash_table_lookup (configs, name) : NULL;
     if (config) {
         if (phase != config->phase) {
             config->phase = phase;
-- 
1.7.10.4

_______________________________________________
SyncEvolution mailing list
[email protected]
https://lists.syncevolution.org/mailman/listinfo/syncevolution

Reply via email to