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
6c0c2175
Commit
6c0c2175
authored
Aug 29, 2013
by
ozantonkal
Committed by
Ozan Tonkal
Sep 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed reference counter in widgets, fixed memory leak
parent
4b443059
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
29 deletions
+6
-29
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+0
-3
widget.cpp
modules/viz/src/widget.cpp
+6
-26
No files found.
modules/viz/include/opencv2/viz/widgets.hpp
View file @
6c0c2175
...
...
@@ -28,9 +28,6 @@ namespace cv
class
Impl
;
Impl
*
impl_
;
friend
struct
WidgetAccessor
;
void
create
();
void
release
();
};
/////////////////////////////////////////////////////////////////////////////
...
...
modules/viz/src/widget.cpp
View file @
6c0c2175
...
...
@@ -7,47 +7,27 @@ class cv::viz::Widget::Impl
{
public
:
vtkSmartPointer
<
vtkProp
>
prop
;
int
ref_counter
;
Impl
()
:
prop
(
0
)
{}
};
cv
::
viz
::
Widget
::
Widget
()
:
impl_
(
0
)
{
create
();
}
cv
::
viz
::
Widget
::
Widget
()
:
impl_
(
new
Impl
()
)
{
}
cv
::
viz
::
Widget
::
Widget
(
const
Widget
&
other
)
:
impl_
(
other
.
impl_
)
cv
::
viz
::
Widget
::
Widget
(
const
Widget
&
other
)
:
impl_
(
new
Impl
()
)
{
if
(
impl_
)
CV_XADD
(
&
impl_
->
ref_counter
,
1
)
;
if
(
other
.
impl_
&&
other
.
impl_
->
prop
)
impl_
->
prop
=
other
.
impl_
->
prop
;
}
cv
::
viz
::
Widget
&
cv
::
viz
::
Widget
::
operator
=
(
const
Widget
&
other
)
{
if
(
this
!=
&
other
)
{
release
();
impl_
=
other
.
impl_
;
if
(
impl_
)
CV_XADD
(
&
impl_
->
ref_counter
,
1
);
}
if
(
!
impl_
)
impl_
=
new
Impl
();
if
(
other
.
impl_
)
impl_
->
prop
=
other
.
impl_
->
prop
;
return
*
this
;
}
cv
::
viz
::
Widget
::~
Widget
()
{
release
();
}
void
cv
::
viz
::
Widget
::
create
()
{
if
(
impl_
)
release
();
impl_
=
new
Impl
();
impl_
->
ref_counter
=
1
;
}
void
cv
::
viz
::
Widget
::
release
()
{
if
(
impl_
&&
CV_XADD
(
&
impl_
->
ref_counter
,
-
1
)
==
1
)
if
(
impl_
)
{
delete
impl_
;
impl_
=
0
;
...
...
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