Skip to content

Commit

Permalink
Ensure validation_layer::context has init before usage
Browse files Browse the repository at this point in the history
Fixes VLCLJ-2304

Signed-off-by: Lisanna Dettwyler <lisanna.dettwyler@intel.com>
  • Loading branch information
lisanna-dettwyler committed Sep 27, 2024
1 parent 3dfafe0 commit 8677cef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace validation_layer
parameterChecker.zeValidation = zeChecker;
parameterChecker.zetValidation = zetChecker;
parameterChecker.zesValidation = zesChecker;
validation_layer::context.validationHandlers.push_back(&parameterChecker);
validation_layer::context.getInstance().validationHandlers.push_back(&parameterChecker);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace validation_layer
templateChecker.zeValidation = zeChecker;
templateChecker.zetValidation = zetChecker;
templateChecker.zesValidation = zesChecker;
validation_layer::context.validationHandlers.push_back(&templateChecker);
validation_layer::context.getInstance().validationHandlers.push_back(&templateChecker);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/layers/validation/ze_validation_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace validation_layer
{
context_t context;
context_t& context = context_t::getInstance();

///////////////////////////////////////////////////////////////////////////////
context_t::context_t()
Expand Down
6 changes: 5 additions & 1 deletion source/layers/validation/ze_validation_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ namespace validation_layer
std::vector<validationChecker *> validationHandlers;
std::unique_ptr<HandleLifetimeValidation> handleLifetime;

static context_t& getInstance() {
static context_t instance;
return instance;
}
context_t();
~context_t();
};

extern context_t context;
extern context_t& context;
} // namespace validation_layer

0 comments on commit 8677cef

Please sign in to comment.