SpecRunnerUtils.jsDocumentManager = require("document/DocumentManager")and DocumentManager.getAllOpenDocuments() (supposed to only output one document - SpecRunnerUtils; otherwise, restart Brackets)_notifyActiveEditorChanged and press Ctrl + E to invoke an inline editorDocumentManager.getAllOpenDocuments() now includes a second document - EditorManager - with a _refCount of 3DocumentManager.getAllOpenDocuments()'s entry for EditorManager has a _refCount of 5 nowCtrl + W to close the full editorDocumentManager.getAllOpenDocuments()'s entry for EditorManager has a _refCount of 4 nowDocumentManager.getAllOpenDocuments()'s entry for EditorManager has a _refCount of 1 nowResult:
On current master, the _refCount of that document, where notably no editor exists any longer, is still 1, which means this document is not gonna get destroyed
Expected:
As it is on ebd613b, _refCount should go down to 0, which means the document will self-destroy
This is the reason for some of the current test failures. I know it makes the UrlCodeHints tests fail, but I suppose it has broader impact.
This is caused by ffa298c78f95c70f98bd905cbba8e2f1fb4a457f, part of #11820
cc @swmitra @nethip @petetnt
It all boils down to this check: https://github.com/adobe/brackets/blob/76f3f993512a16a7f28b935f0cc07e6131863d83/src/editor/EditorManager.js#L548
As the pane id is not set, a new full editor with the same document is being created, which increases the refCount; but that refCount is not decreased to 0 afterwards
Nice job debugging the cause @MarcelGerber :+1:
Great job @MarcelGerber :+1:
I will try to have a look at it today...
Good job @MarcelGerber. Let us target this for 1.7.
@MarcelGerber @petetnt This problem should be resolved by https://github.com/adobe/brackets/pull/12405.
Resolved with #12405. Thanks @swmitra.
Closing.
I am deeply sorry, but I have to reopen this.
As I just ran the unit tests, I noticed the failure of EditorManager test should use an existing editor for a document when requested on same pane (with the additional message Error: Expected spy addView not to have been called.).
git bisect points to 7990632650cc67bf664800de433ab827f681f2e6 (cc @swmitra), the test passed before this commit.
@MarcelGerber I just saw the error but really confused about the resolution of the problem. The expectation in our actual code is that when a document is getting opened explicitly in current active pane, we do call addView. I will try to debug our code in the actual scenario and see if the test itself needs to be updated.
Edit Can confirm, this particular test has to be updated as the created editor using _SpecRunnerUtils.createEditorInstance_ is never added to the pane , hence when we try to show it , we are going to call addView. One alternate is that we add the pane.addView call in _SpecRunnerUtils.createEditorInstance_ itself , but then again the test will fail if we don't modify it.
Following points are resolution options...
@MarcelGerber @petetnt @nethip What do you think guys ?
@swmitra I think if I understand it right, because the semantics have now changed, we need to update the test cases. But do analyze and see if it is going to effect extensions.
@MarcelGerber @nethip Can you guys please have a look at the PR.
Thanks in advance :+1:
Most helpful comment
It all boils down to this check: https://github.com/adobe/brackets/blob/76f3f993512a16a7f28b935f0cc07e6131863d83/src/editor/EditorManager.js#L548
As the pane id is not set, a new full editor with the same document is being created, which increases the refCount; but that refCount is not decreased to 0 afterwards