Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
9353e464
Commit
9353e464
authored
Jun 27, 2012
by
Peter Eastman
Browse files
Fixed errors in which destructors were executed in the wrong order
parent
0a850783
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
olla/src/Kernel.cpp
olla/src/Kernel.cpp
+10
-3
openmmapi/src/ContextImpl.cpp
openmmapi/src/ContextImpl.cpp
+8
-0
platforms/cuda2/src/CudaContext.cpp
platforms/cuda2/src/CudaContext.cpp
+0
-1
No files found.
olla/src/Kernel.cpp
View file @
9353e464
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2012
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -41,7 +41,8 @@ Kernel::Kernel(KernelImpl* impl) : impl(impl) {
}
Kernel
::
Kernel
(
const
Kernel
&
copy
)
:
impl
(
copy
.
impl
)
{
impl
->
referenceCount
++
;
if
(
impl
)
impl
->
referenceCount
++
;
}
Kernel
::~
Kernel
()
{
...
...
@@ -53,8 +54,14 @@ Kernel::~Kernel() {
}
Kernel
&
Kernel
::
operator
=
(
const
Kernel
&
copy
)
{
if
(
impl
)
{
impl
->
referenceCount
--
;
if
(
impl
->
referenceCount
==
0
)
delete
impl
;
}
impl
=
copy
.
impl
;
impl
->
referenceCount
++
;
if
(
impl
)
impl
->
referenceCount
++
;
return
*
this
;
}
...
...
openmmapi/src/ContextImpl.cpp
View file @
9353e464
...
...
@@ -118,6 +118,14 @@ ContextImpl::ContextImpl(Context& owner, System& system, Integrator& integrator,
ContextImpl
::~
ContextImpl
()
{
for
(
int
i
=
0
;
i
<
(
int
)
forceImpls
.
size
();
++
i
)
delete
forceImpls
[
i
];
// Make sure all kernels get properly deleted before contextDestroyed() is called.
initializeForcesKernel
=
Kernel
();
kineticEnergyKernel
=
Kernel
();
updateStateDataKernel
=
Kernel
();
applyConstraintsKernel
=
Kernel
();
virtualSitesKernel
=
Kernel
();
platform
->
contextDestroyed
(
*
this
);
}
...
...
platforms/cuda2/src/CudaContext.cpp
View file @
9353e464
...
...
@@ -229,7 +229,6 @@ CudaContext::~CudaContext() {
string
errorMessage
=
"Error deleting Context"
;
if
(
contextIsValid
)
CHECK_RESULT
(
cuCtxDestroy
(
context
));
contextIsValid
=
false
;
}
void
CudaContext
::
initialize
()
{
...
...
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