Index: sync/syncable/directory.cc |
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc |
index 9348338925f114f2e8052c7323fc4f30bebf0255..34df6da140ed78b4b063d3c55aca3a902bd235a5 100644 |
--- a/sync/syncable/directory.cc |
+++ b/sync/syncable/directory.cc |
@@ -204,6 +204,15 @@ DirOpenResult Directory::OpenImpl( |
kernel_ = new Kernel(name, info, delegate, transaction_observer); |
kernel_->metahandles_index->swap(metas_bucket); |
InitializeIndices(); |
+ |
+ // Write back the share info to reserve some space in 'next_id'. This will |
+ // prevent local ID reuse in the case of an early crash. See the comments in |
+ // TakeSnapshotForSaveChanges() or crbug.com/142987 for more information. |
+ kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; |
+ if (!SaveChanges()) { |
+ result = FAILED_INITIAL_WRITE; |
Nicolas Zea
2012/08/16 20:40:10
return FAILED_INITIAL_WRITE?
rlarocque
2012/08/17 18:02:07
Wow, that was a dumb mistake. Fixed.
Unfortunate
|
+ } |
+ |
return OPENED; |
} |