diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2014-11-13 14:38:58 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2014-11-13 15:26:51 +0100 |
commit | 3a8564c1f5d034a3b205d21bb602225ee97a8419 (patch) | |
tree | e3c64f62f101626c571af7fe8a5b4939d16f3f53 /src/plugins/coreplugin/documentmanager.cpp | |
parent | 7cb9b0cfaad2b8425da9fd3459dd9d8060a08ff2 (diff) | |
download | qt-creator-3a8564c1f5d034a3b205d21bb602225ee97a8419.tar.gz |
Fix reloading documents when they are changed fast, multiple times.
This can for example happen when doing interactive git rebases.
* When a file was changed after we reloaded it, but before we removed
+readded the watcher, we wouldn't get a notification for these changes.
* When we got a file changed notification while we were in checkForReload
(because of event processing of the dialog, or file loading), the
notification was dropped and only processes when a check was triggered
again (e.g. at window activation, or when some (other) file changed)
Change-Id: Iab1861a8f05c739a3405bc1afe90ae6f2145057b
Task-number: QTCREATORBUG-9745
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/coreplugin/documentmanager.cpp')
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 9ae7a49185..dbf647afdc 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -908,14 +908,16 @@ void DocumentManager::checkForReload() if (!QApplication::activeWindow()) return; - if (QApplication::activeModalWidget()) { // a modal dialog, recheck later + if (QApplication::activeModalWidget() || d->m_blockActivated) { + // We do not want to prompt for modified file if we currently have some modal dialog open. + // If d->m_blockActivated is true, then it means that the event processing of either the + // file modified dialog, or of loading large files, has delivered a file change event from + // a watcher *and* the timer triggered. We may never end up here in a nested way, so + // recheck later. QTimer::singleShot(200, this, SLOT(checkForReload())); return; } - if (d->m_blockActivated) - return; - d->m_blockActivated = true; IDocument::ReloadSetting defaultBehavior = EditorManagerPrivate::reloadSetting(); @@ -1009,6 +1011,14 @@ void DocumentManager::checkForReload() // handle it! d->m_blockedIDocument = document; + // Update file info, also handling if e.g. link target has changed. + // We need to do that before the file is reloaded, because removing the watcher will + // loose any pending change events. Loosing change events *before* the file is reloaded + // doesn't matter, because in that case we then reload the new version of the file already + // anyhow. + removeFileInfo(document); + addFileInfo(document); + bool success = true; QString errorString; // we've got some modification @@ -1110,9 +1120,6 @@ void DocumentManager::checkForReload() errorStrings << errorString; } - // update file info, also handling if e.g. link target has changed - removeFileInfo(document); - addFileInfo(document); d->m_blockedIDocument = 0; } if (!errorStrings.isEmpty()) |