File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
IGC/AdaptorOCL/ocl_igc_interface/impl Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,22 @@ inline TC::TB_DATA_FORMAT toLegacyFormat(CodeType::CodeType_t format){
86
86
}
87
87
}
88
88
89
+ struct IGC_State {
90
+ protected:
91
+ bool isAlive;
92
+ public:
93
+ IGC_State () {
94
+ isAlive = true ;
95
+ }
96
+ ~IGC_State () {
97
+ isAlive = false ;
98
+ }
99
+ static const bool isDestructed () {
100
+ static const IGC_State obj;
101
+ return !obj.isAlive ;
102
+ }
103
+ };
104
+
89
105
CIF_DECLARE_INTERFACE_PIMPL (IgcOclTranslationCtx) : CIF::PimplBase
90
106
{
91
107
CIF_PIMPL_DECLARE_CONSTRUCTOR (CIF::Version_t version, CIF_PIMPL (IgcOclDeviceCtx) *globalState,
@@ -115,6 +131,9 @@ CIF_DECLARE_INTERFACE_PIMPL(IgcOclTranslationCtx) : CIF::PimplBase
115
131
CIF::Builtins::BufferSimple *outSpecConstantsIds,
116
132
CIF::Builtins::BufferSimple *outSpecConstantsSizes)
117
133
{
134
+ if (IGC_State::isDestructed ()) {
135
+ return false ;
136
+ }
118
137
bool success = false ;
119
138
const char * pInput = src->GetMemory <char >();
120
139
uint32_t inputSize = static_cast <uint32_t >(src->GetSizeRaw ());
@@ -159,6 +178,10 @@ CIF_DECLARE_INTERFACE_PIMPL(IgcOclTranslationCtx) : CIF::PimplBase
159
178
if (outputInterface == nullptr ){
160
179
return nullptr ; // OOM
161
180
}
181
+ if (IGC_State::isDestructed ()) {
182
+ outputInterface->GetImpl ()->SetError (TranslationErrorType::UnhandledInput, " IGC is destructed" );
183
+ return outputInterface.release ();
184
+ }
162
185
163
186
TC::STB_TranslateInputArgs inputArgs;
164
187
if (src != nullptr ){
You can’t perform that action at this time.
0 commit comments