mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
fix: fail L0 device creation when invalid state save area header was delivered
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
70bb654c15
commit
5b51146673
@@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
template <typename T>
|
||||
class VariableBackup {
|
||||
@@ -36,3 +37,20 @@ class VariableBackup {
|
||||
T oldValue;
|
||||
T *pValue;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class NonCopyableVariableBackup {
|
||||
public:
|
||||
NonCopyableVariableBackup(T *ptr, T &&newValue) : pValue(ptr) {
|
||||
oldValue = std::move(*ptr);
|
||||
*pValue = std::move(newValue);
|
||||
}
|
||||
|
||||
~NonCopyableVariableBackup() {
|
||||
*pValue = std::move(oldValue);
|
||||
}
|
||||
|
||||
private:
|
||||
T oldValue;
|
||||
T *pValue;
|
||||
};
|
||||
Reference in New Issue
Block a user