Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
750e80f1
Commit
750e80f1
authored
Mar 08, 2010
by
Alexander Wiebel
Browse files
[FIX
#244
] Fixed another memory leak. This should fix
#244
now.
parent
eed37251
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
7 deletions
+52
-7
src/modules/fiberDisplay/WROIManagerFibers.cpp
src/modules/fiberDisplay/WROIManagerFibers.cpp
+29
-2
src/modules/fiberDisplay/WROIManagerFibers.h
src/modules/fiberDisplay/WROIManagerFibers.h
+6
-1
src/modules/fiberDisplay/WUpdateThread.cpp
src/modules/fiberDisplay/WUpdateThread.cpp
+4
-2
src/modules/fiberDisplay/WUpdateThread.h
src/modules/fiberDisplay/WUpdateThread.h
+13
-2
No files found.
src/modules/fiberDisplay/WROIManagerFibers.cpp
View file @
750e80f1
...
...
@@ -197,8 +197,35 @@ void WROIManagerFibers::recalculate()
void
WROIManagerFibers
::
setDirty
()
{
WUpdateThread
*
t
=
new
WUpdateThread
(
shared_from_this
()
);
t
->
run
();
boost
::
unique_lock
<
boost
::
shared_mutex
>
lock
;
{
boost
::
shared_ptr
<
WUpdateThread
>
t
=
boost
::
shared_ptr
<
WUpdateThread
>
(
new
WUpdateThread
(
shared_from_this
()
)
);
t
->
run
();
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_updateListLock
);
m_updateThreads
.
push_back
(
t
);
lock
.
unlock
();
}
{
lock
=
boost
::
unique_lock
<
boost
::
shared_mutex
>
(
m_updateListLock
);
std
::
list
<
boost
::
shared_ptr
<
WUpdateThread
>
>::
iterator
itr
;
// remove finished threads
for
(
itr
=
m_updateThreads
.
begin
();
itr
!=
m_updateThreads
.
end
();
)
{
if
(
(
*
itr
)
->
isFinished
()
)
{
itr
=
m_updateThreads
.
erase
(
itr
);
}
else
{
++
itr
;
}
}
lock
.
unlock
();
}
}
boost
::
shared_ptr
<
const
WDataSetFibers
>
WROIManagerFibers
::
getDataSet
()
...
...
src/modules/fiberDisplay/WROIManagerFibers.h
View file @
750e80f1
...
...
@@ -34,6 +34,7 @@
#include "WMFiberDisplay.h"
#include "WRMBranch.h"
#include "WUpdateThread.h"
/**
* Class to store and manage different ROI's for fiber selection
...
...
@@ -152,10 +153,14 @@ private:
std
::
list
<
boost
::
shared_ptr
<
WRMBranch
>
>
m_branches
;
//!< list of branches in the logical tree structure
std
::
list
<
boost
::
shared_ptr
<
WUpdateThread
>
>
m_updateThreads
;
//!< list ofcurrent update threads.
boost
::
shared_mutex
m_updateListLock
;
//!< Lock to prevent concurrent threads trying to update the list
/**
* Stores a pointer to the kdTree used for fiber selection
*/
boost
::
shared_ptr
<
WKdTree
>
m_kdTree
;
boost
::
shared_ptr
<
WKdTree
>
m_kdTree
;
/**
* Lock for associated notifiers set.
...
...
src/modules/fiberDisplay/WUpdateThread.cpp
View file @
750e80f1
...
...
@@ -26,9 +26,10 @@
#include "WUpdateThread.h"
WUpdateThread
::
WUpdateThread
(
boost
::
shared_ptr
<
WROIManagerFibers
>
roiManager
)
:
WUpdateThread
::
WUpdateThread
(
boost
::
shared_ptr
<
WROIManagerFibers
>
roiManager
)
:
WThreadedRunner
(),
m_roiManager
(
roiManager
)
m_roiManager
(
roiManager
),
m_myThreadFinished
(
false
)
{
}
...
...
@@ -39,4 +40,5 @@ WUpdateThread::~WUpdateThread()
void
WUpdateThread
::
threadMain
()
{
m_roiManager
->
recalculate
();
m_myThreadFinished
=
true
;
}
src/modules/fiberDisplay/WUpdateThread.h
View file @
750e80f1
...
...
@@ -44,16 +44,27 @@ public:
/**
* destructor
*/
~
WUpdateThread
();
virtual
~
WUpdateThread
();
/**
* entry for the run command
*/
virtual
void
threadMain
();
/**
* Return the value of the finished flag.
*/
inline
bool
isFinished
();
protected:
private:
boost
::
shared_ptr
<
WROIManagerFibers
>
m_roiManager
;
//!< stores pointer to the roi manager
boost
::
shared_ptr
<
WROIManagerFibers
>
m_roiManager
;
//!< stores pointer to the roi manager
bool
m_myThreadFinished
;
//!< Has the thread finished?
};
bool
WUpdateThread
::
isFinished
()
{
return
m_myThreadFinished
;
}
#endif // WUPDATETHREAD_H
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