aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/event.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/stream_executor/event.cc')
-rw-r--r--tensorflow/stream_executor/event.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/tensorflow/stream_executor/event.cc b/tensorflow/stream_executor/event.cc
index 50a6edd80b..52efe771bc 100644
--- a/tensorflow/stream_executor/event.cc
+++ b/tensorflow/stream_executor/event.cc
@@ -15,9 +15,9 @@ limitations under the License.
#include "tensorflow/stream_executor/event.h"
+#include "tensorflow/stream_executor/stream.h"
#include "tensorflow/stream_executor/stream_executor_internal.h"
#include "tensorflow/stream_executor/stream_executor_pimpl.h"
-#include "tensorflow/stream_executor/stream.h"
namespace stream_executor {
@@ -27,9 +27,12 @@ Event::Event(StreamExecutor* stream_exec)
stream_exec_->implementation()->CreateEventImplementation()) {}
Event::~Event() {
- auto status = stream_exec_->DeallocateEvent(this);
- if (!status.ok()) {
- LOG(ERROR) << status.error_message();
+ // Deal with nullptr implementation_, as this event may have been std::moved.
+ if (stream_exec_ && implementation_) {
+ auto status = stream_exec_->DeallocateEvent(this);
+ if (!status.ok()) {
+ LOG(ERROR) << status.error_message();
+ }
}
}