Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
3830a0b5
Commit
3830a0b5
authored
Nov 24, 2013
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug with deletion from std::map
parent
a6ab9be5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
precomp.hpp
modules/viz/src/precomp.hpp
+2
-2
viz.cpp
modules/viz/src/viz.cpp
+7
-5
viz3d.cpp
modules/viz/src/viz3d.cpp
+8
-2
No files found.
modules/viz/src/precomp.hpp
View file @
3830a0b5
...
...
@@ -149,8 +149,8 @@ namespace cv
VizStorage
();
// Static
~
VizStorage
();
static
void
add
(
Viz3d
window
);
static
Viz3d
get
(
const
String
&
window_name
);
static
void
add
(
const
Viz3d
&
window
);
static
Viz3d
&
get
(
const
String
&
window_name
);
static
void
remove
(
const
String
&
window_name
);
static
bool
windowExists
(
const
String
&
window_name
);
static
void
removeUnreferenced
();
...
...
modules/viz/src/viz.cpp
View file @
3830a0b5
...
...
@@ -112,7 +112,7 @@ namespace cv { namespace viz
cv
::
viz
::
VizMap
cv
::
viz
::
VizStorage
::
storage
;
void
cv
::
viz
::
VizStorage
::
unregisterAll
()
{
storage
.
clear
();
}
cv
::
viz
::
Viz3d
cv
::
viz
::
VizStorage
::
get
(
const
String
&
window_name
)
cv
::
viz
::
Viz3d
&
cv
::
viz
::
VizStorage
::
get
(
const
String
&
window_name
)
{
String
name
=
generateWindowName
(
window_name
);
VizMap
::
iterator
vm_itr
=
storage
.
find
(
name
);
...
...
@@ -120,7 +120,7 @@ cv::viz::Viz3d cv::viz::VizStorage::get(const String &window_name)
return
vm_itr
->
second
;
}
void
cv
::
viz
::
VizStorage
::
add
(
Viz3d
window
)
void
cv
::
viz
::
VizStorage
::
add
(
const
Viz3d
&
window
)
{
String
window_name
=
window
.
getWindowName
();
VizMap
::
iterator
vm_itr
=
storage
.
find
(
window_name
);
...
...
@@ -136,9 +136,11 @@ bool cv::viz::VizStorage::windowExists(const String &window_name)
void
cv
::
viz
::
VizStorage
::
removeUnreferenced
()
{
for
(
VizMap
::
iterator
pos
=
storage
.
begin
();
pos
!=
storage
.
end
();
++
pos
)
for
(
VizMap
::
iterator
pos
=
storage
.
begin
();
pos
!=
storage
.
end
();)
if
(
pos
->
second
.
impl_
->
ref_counter
==
1
)
storage
.
erase
(
pos
);
storage
.
erase
(
pos
++
);
else
++
pos
;
}
cv
::
String
cv
::
viz
::
VizStorage
::
generateWindowName
(
const
String
&
window_name
)
...
...
@@ -159,5 +161,5 @@ cv::String cv::viz::VizStorage::generateWindowName(const String &window_name)
return
output
;
}
cv
::
viz
::
Viz3d
cv
::
viz
::
get
(
const
String
&
window_name
)
{
return
Viz3d
(
window_name
);
}
cv
::
viz
::
Viz3d
cv
::
viz
::
get
(
const
String
&
window_name
)
{
return
Viz3d
(
window_name
);
}
void
cv
::
viz
::
unregisterAllWindows
()
{
VizStorage
::
unregisterAll
();
}
modules/viz/src/viz3d.cpp
View file @
3830a0b5
...
...
@@ -62,7 +62,8 @@ cv::viz::Viz3d& cv::viz::Viz3d::operator=(const Viz3d& other)
{
release
();
impl_
=
other
.
impl_
;
if
(
impl_
)
CV_XADD
(
&
impl_
->
ref_counter
,
1
);
if
(
impl_
)
CV_XADD
(
&
impl_
->
ref_counter
,
1
);
}
return
*
this
;
}
...
...
@@ -89,10 +90,15 @@ void cv::viz::Viz3d::create(const String &window_name)
void
cv
::
viz
::
Viz3d
::
release
()
{
if
(
impl_
&&
CV_XADD
(
&
impl_
->
ref_counter
,
-
1
)
==
1
)
{
delete
impl_
;
impl_
=
0
;
}
if
(
impl_
&&
impl_
->
ref_counter
==
1
)
VizStorage
::
removeUnreferenced
();
impl_
=
0
;
VizStorage
::
removeUnreferenced
();
}
void
cv
::
viz
::
Viz3d
::
spin
()
{
impl_
->
spin
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment