Hi Patrick,
On Sep 15, 2011, at 11:56 , Patrick Ohly wrote:
> [...]
> The sync then aborts and during flushing the current state for a suspend
> segfaults when trying to read the bogus 0x20 local ID pointer.
This is because of TCustomImplDS::implProcessItem():
[...]
===> augmentedItemP = (TMultiFieldItem
*)SendDBVersionOfItemAsServer(myitemP);
[...]
====> delete augmentedItemP; augmentedItemP = NULL;
The 207 code path goes through the two marked lines. I suppose setting
augmentedItemP in the first line is wrong? It's not needed and must not
be freed.
Exactly, thanks for finding this.
I am a bit spoilt by retain/release mechanism in ObjC ;-)
In the meantime, I have consolidated my repositories and merged your branches into luz and
updated it with what was pending from my side so far, including this one now.
Best Regards,
Lukas
From d649138efc02e959cb1197a58afa7a6b5c1e959f Mon Sep 17 00:00:00 2001
From: Lukas Zeller <luz(a)plan44.ch>
Date: Thu, 15 Sep 2011 14:51:18 +0200
Subject: [PATCH] engine: fixed bad object delete case (Patrick found it) -
SendDBVersionOfItemAsServer() does not pass ownership for
item returned!
---
src/sysync/customimplds.cpp | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/sysync/customimplds.cpp b/src/sysync/customimplds.cpp
index 888cde0..f790b05 100755
--- a/src/sysync/customimplds.cpp
+++ b/src/sysync/customimplds.cpp
@@ -2903,7 +2903,8 @@ bool TCustomImplDS::implProcessItem(
}
else {
// augmented version was created in backend, fetch it now and add to list
of items to be sent
- augmentedItemP = (TMultiFieldItem
*)SendDBVersionOfItemAsServer(myitemP);
+ // Note: item remains owned by list of items to be sent, so we don't
need to dispose it.
+ SendDBVersionOfItemAsServer(myitemP);
}
}
sta = LOCERR_OK; // otherwise, treat as ok
--
1.7.5.4+GitX