Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager.js

Issue 560273002: Fix possible race with batch updates in Files app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/file_manager.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index 82ffcf3c1ff9c7c54942c37db64aff26238b9834..38663e912abd33d16eadd48c0ee4d2b823e48fff 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -823,13 +823,20 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
var dm = this.directoryModel_;
dm.addEventListener('directory-changed',
this.onDirectoryChanged_.bind(this));
+
+ var listBeingUpdated = null;
dm.addEventListener('begin-update-files', function() {
self.currentList_.startBatchUpdates();
+ // Remember the list which was used when updating files started, so
+ // endBatchUpdates() is called on the same list.
+ listBeingUpdated = self.currentList_;
});
dm.addEventListener('end-update-files', function() {
self.restoreItemBeingRenamed_();
- self.currentList_.endBatchUpdates();
+ listBeingUpdated.endBatchUpdates();
+ listBeingUpdated = null;
});
+
dm.addEventListener('scan-started', this.onScanStarted_.bind(this));
dm.addEventListener('scan-completed', this.onScanCompleted_.bind(this));
dm.addEventListener('scan-failed', this.onScanCancelled_.bind(this));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698