Skip to content

Commit c1f03cb

Browse files
committed
librviz_tutorial: Cleaned up myviz destructor based on changes to rviz::RenderPanel.
1 parent 99852d1 commit c1f03cb

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*~
2+
*.pyc
23
bin
34
build
45
lib

librviz_tutorial/src/doc/index.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,3 @@ Running
6565
Just type::
6666

6767
rosrun librviz_tutorial myviz
68-
69-
I want to reiterate here the warning at the top of this page, which is
70-
that the APIs will change between Fuerte and Groovy. I would love for
71-
people to try out these APIs and submit bugs describing problems with
72-
them, so the next version can be much better.

librviz_tutorial/src/myviz.cpp

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,36 +95,9 @@ MyViz::MyViz( QWidget* parent )
9595
cell_size_slider->setValue( 10 );
9696
}
9797

98-
// Destructor for MyViz. The complexity here is something I would
99-
// like to avoid in future versions.
100-
//
101-
// Removing all the displays first is not technically required for
102-
// this example, but if we used a PropertyTreeWidget it would be
103-
// required, so it is a good idea.
104-
//
105-
// It would be required because Display objects own Properties, and
106-
// Properties own children of PropertyTreeWidget
107-
// (PropertyWidgetItems). PropertyTreeWidget notices when
108-
// PropertyWidgetItems are destroyed, but Properties don't notice when
109-
// PropertyWidgetItems are destroyed, so must destroy from the Display
110-
// (and thus Property) side first.
111-
//
112-
// The ``render_panel_`` is a child widget of MyViz and so would be
113-
// deleted naturally by the QWidget destructor, but that would be
114-
// after we deleted ``manager_``. Instead we must delete
115-
// ``render_panel_`` *before* ``manager_`` because
116-
// ``~VisualizationManager()`` destroys ogre SceneManager which
117-
// destroys all attached SceneNodes. RenderPanel indirectly holds
118-
// pointers to SceneNodes which it destroys. RenderPanel doesn't know
119-
// when Ogre destroys its SceneNodes, so RenderPanel would cause a
120-
// segfault during its destructor.
98+
// Destructor.
12199
MyViz::~MyViz()
122100
{
123-
if( manager_ != NULL )
124-
{
125-
manager_->removeAllDisplays();
126-
}
127-
delete render_panel_;
128101
delete manager_;
129102
}
130103

0 commit comments

Comments
 (0)