Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hppmanipulationwidgets] Fix memory allocation bug. #52

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/hpp/plot/hpp-manipulation-graph.hh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class HppManipulationGraphWidget : public GraphWidget {
QString constraintStr;
QGVNode* node;

::hpp::ConfigProjStat_var configStat, pathStat;
::hpp::ConfigProjStat configStat, pathStat;
::CORBA::Long freq;
::hpp::intSeq_var freqPerCC;
NodeInfo();
Expand All @@ -126,7 +126,7 @@ class HppManipulationGraphWidget : public GraphWidget {
QString shortStr;
QGVEdge* edge;

::hpp::ConfigProjStat_var configStat, pathStat;
::hpp::ConfigProjStat configStat, pathStat;
::hpp::Names_t_var errors;
::hpp::intSeq_var freqs;

Expand Down
32 changes: 16 additions & 16 deletions src/hpp-manipulation-graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ void HppManipulationGraphWidget::updateStatistics() {
QGVNode* node = dynamic_cast<QGVNode*>(elmt);
if (node) {
NodeInfo& ni = nodeInfos_[node];
manip_->graph()->getConfigProjectorStats(ni.id, ni.configStat.out(),
ni.pathStat.out());
manip_->graph()->getConfigProjectorStats(ni.id, ni.configStat,
ni.pathStat);
ni.freq = manip_->graph()->getFrequencyOfNodeInRoadmap(
ni.id, ni.freqPerCC.out());
float sr = (ni.configStat->nbObs > 0) ? (float)ni.configStat->success /
(float)ni.configStat->nbObs
: 0.f / 0.f;
float sr = (ni.configStat.nbObs > 0) ? (float)ni.configStat.success /
(float)ni.configStat.nbObs
: 0.f / 0.f;
QString colorcode =
(ni.configStat->nbObs > 0)
(ni.configStat.nbObs > 0)
? QColor(255, (int)(sr * 255), (int)(sr * 255)).name()
: "white";
const QString& fillcolor = node->getAttribute("fillcolor");
Expand All @@ -292,13 +292,13 @@ void HppManipulationGraphWidget::updateStatistics() {
QGVEdge* edge = dynamic_cast<QGVEdge*>(elmt);
if (edge) {
EdgeInfo& ei = edgeInfos_[edge];
manip_->graph()->getConfigProjectorStats(ei.id, ei.configStat.out(),
ei.pathStat.out());
manip_->graph()->getConfigProjectorStats(ei.id, ei.configStat,
ei.pathStat);
manip_->graph()->getEdgeStat(ei.id, ei.errors.out(), ei.freqs.out());
float sr = (ei.configStat->nbObs > 0) ? (float)ei.configStat->success /
(float)ei.configStat->nbObs
: 0.f / 0.f;
QString colorcode = (ei.configStat->nbObs > 0)
float sr = (ei.configStat.nbObs > 0) ? (float)ei.configStat.success /
(float)ei.configStat.nbObs
: 0.f / 0.f;
QString colorcode = (ei.configStat.nbObs > 0)
? QColor(255 - (int)(sr * 255), 0, 0).name()
: "";
const QString& color = edge->getAttribute("color");
Expand Down Expand Up @@ -511,13 +511,13 @@ void HppManipulationGraphWidget::startStopUpdateStats(bool start) {

HppManipulationGraphWidget::NodeInfo::NodeInfo()
: id(-1), freq(0), freqPerCC(new ::hpp::intSeq()) {
initConfigProjStat(configStat.out());
initConfigProjStat(pathStat.out());
initConfigProjStat(configStat);
initConfigProjStat(pathStat);
}

HppManipulationGraphWidget::EdgeInfo::EdgeInfo() : id(-1), edge(NULL) {
initConfigProjStat(configStat.out());
initConfigProjStat(pathStat.out());
initConfigProjStat(configStat);
initConfigProjStat(pathStat);
errors = new Names_t();
freqs = new intSeq();
}
Expand Down
Loading