diff --git a/sycl/source/detail/event_impl.cpp b/sycl/source/detail/event_impl.cpp index ee367a828a1d4..6a1bd677b702e 100644 --- a/sycl/source/detail/event_impl.cpp +++ b/sycl/source/detail/event_impl.cpp @@ -192,7 +192,7 @@ event_impl::event_impl(const QueueImplPtr &Queue) } void event_impl::setQueue(queue_impl &Queue) { - MQueue = Queue.shared_from_this(); + MQueue = Queue.weak_from_this(); MIsProfilingEnabled = Queue.MIsProfilingEnabled; // TODO After setting the queue, the event is no longer default @@ -202,9 +202,9 @@ void event_impl::setQueue(queue_impl &Queue) { } void event_impl::setSubmittedQueue(std::weak_ptr SubmittedQueue) { - MSubmittedQueue = SubmittedQueue; + MSubmittedQueue = std::move(SubmittedQueue); if (MHostProfilingInfo) { - if (auto QueuePtr = SubmittedQueue.lock()) { + if (auto QueuePtr = MSubmittedQueue.lock()) { device_impl &Device = QueuePtr->getDeviceImpl(); MHostProfilingInfo->setDevice(&Device); } diff --git a/sycl/source/detail/event_impl.hpp b/sycl/source/detail/event_impl.hpp index 0399cafb9613a..803eaa0712c34 100644 --- a/sycl/source/detail/event_impl.hpp +++ b/sycl/source/detail/event_impl.hpp @@ -235,7 +235,7 @@ class event_impl { /// /// @return void setWorkerQueue(std::weak_ptr WorkerQueue) { - MWorkerQueue = WorkerQueue; + MWorkerQueue = std::move(WorkerQueue); }; /// Sets original queue used for submission.