diff options
author | Alastair Murray <alastair.murray@codeplay.com> | 2018-07-06 12:58:20 +0100 |
---|---|---|
committer | Alastair Murray <alastair.murray@codeplay.com> | 2018-07-06 12:58:20 +0100 |
commit | 25661b2d6f85fbc3bf8cd47ad1b9b5e857cfefba (patch) | |
tree | 921eddaac084701e9f6f062df31631773327eced /src | |
parent | 43e3f27254c4f7e4a0b332f5b88965c53c20bdd1 (diff) |
Eliminate a temporary Program object
This was causing a crash for me because the temporary Program destructor called
clReleaseProgram on the cl_program with Program, and then clBuildProgram was
called on the same cl_program (belonging to the Program owned by the
shared_ptr, but it's the same cl_program).
Diffstat (limited to 'src')
-rw-r--r-- | src/routine.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/routine.cpp b/src/routine.cpp index 4caa4d7b..2df6d563 100644 --- a/src/routine.cpp +++ b/src/routine.cpp @@ -96,7 +96,7 @@ void Routine::InitProgram(std::initializer_list<const char *> source) { auto binary = BinaryCache::Instance().Get(BinaryKeyRef{platform_id, precision_, routine_info, device_name }, &has_binary); if (has_binary) { - program_ = std::make_shared<Program>(Program(device_, context_, binary)); + program_ = std::make_shared<Program>(device_, context_, binary); program_->Build(device_, options); ProgramCache::Instance().Store(ProgramKey{ context_(), device_(), precision_, routine_info }, std::shared_ptr<Program>{program_}); |