Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352350

Summary: Outline view corrupts expansion state of namespace nodes
Product: [Tools] CDT Reporter: Jens Elmenthaler <jens.elmenthaler>
Component: cdt-editorAssignee: Anton Leherbauer <aleherb+eclipse>
Status: RESOLVED FIXED QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0   
Target Milestone: 8.0.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test case + fix aleherb+eclipse: iplog+

Description Jens Elmenthaler CLA 2011-07-18 11:02:00 EDT
Build Identifier: CDT 8.0

1) Create a C++ Project with the following two files:

Something.hpp
// Empty

Somthing.cpp
namespace {
  int number0;
  int number1;
}

namespace N {
  int number2;
}

2) Open Something.cpp and expand the anonymous namespace.
3) Open Something.hpp
4) Switch back to Something.cpp. For about 1s, the anonymous namespace node is still expanded. Then it gets collapsed.
5) Enable "Link with Editor" in the outline view. In the editor, select number0. It will not be revealed in the outline view.
6) Manually expand the anonymous namespace in the outline view.
7) In the editor, click number0 again. Now it is revealed in the outline view.

My actual problem is the following:
1) Open something in an XML editor. Make sure the outline view is visible
2) Switch back to Something.cpp and wait until the anonymous namespace is collapsed.
3) Click number2 in the outline view.
4) The anonymous namespace node is expanded
5) number1 instead of number2 is selected in the outline view and revealed in the editor.

I guess both have the same root cause.

Reproducible: Always
Comment 1 Jens Elmenthaler CLA 2011-07-19 07:16:55 EDT
Created attachment 199891 [details]
test case + fix

Amazing this bug!
Comment 2 Anton Leherbauer CLA 2011-07-20 05:30:16 EDT
Good catch and thanks for the patch!
Committed to master and cdt_8_0.
Comment 3 CDT Genie CLA 2011-07-20 06:19:36 EDT
*** cdt git genie on behalf of 352350 ***

    Bug 352350 - Outline view corrupts expansion state of namespace nodes

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9d9efe8e9d73583167fd33ac7b696403bbccfebc
Comment 4 CDT Genie CLA 2011-07-20 06:19:38 EDT
*** cdt git genie on behalf of 352350 ***

    Bug 352350 - Outline view corrupts expansion state of namespace nodes

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9bf683c83a56b646353e6804e45e5245b4be869d