Apply the following patch:
Do the following:
1) Don't open any project
2) Open two cpp files, let's say: a.cpp and b.cpp. You should notice 2 debug lines about creating CppEditor. (Later in text I mark such a line with: "Create")
3) Split the editor - new debug line: "Create".
4) In the bottom split, change the current editor (with combobox) to a.cpp. No debug line.
5) In the top split change the current editor to:
5a) a.cpp. A new debug line: "Create"
5b) b.cpp. No new debug line.
Until now the behaviour was expected.
5c) a.cpp. A new debug line: "Create". Why duplicate editor is called now? (looks like a buggy behaviour)
5d) b.cpp. No new debug line.
5e) a.cpp. Again, a new debug line: "Create" (bug?). When I repeat 5d and 5e I always see, that a new editor is being created on 5e.
6) Close the top split. I get several debug lines about destructor (the number of these lines is the same as number of "Create" lines minus 2 (for the 2 editors in the bottom split)). Everything is properly destroyed, but it proves, that I could have even 100 editors created for only 4 available (2 in top split, 2 in bottom split), depending on switching in top combobox.