Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional leaks #2257

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mbgl/mtl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ UniqueShaderProgram Context::createProgram(std::string name,
NS::String* nsSource = NS::String::string(source.data(), NS::UTF8StringEncoding);

const auto& device = backend.getDevice();
MTL::Library* library = device->newLibrary(nsSource, options.get(), &error);
auto library = NS::TransferPtr(device->newLibrary(nsSource, options.get(), &error));
if (!library || error) {
const auto errPtr = error ? error->localizedDescription()->utf8String() : nullptr;
const auto errStr = (errPtr && errPtr[0]) ? ": " + std::string(errPtr) : std::string();
Expand All @@ -135,7 +135,7 @@ UniqueShaderProgram Context::createProgram(std::string name,
}

const auto nsVertName = NS::String::string(vertexName.data(), NS::UTF8StringEncoding);
NS::SharedPtr<MTL::Function> vertexFunction = NS::RetainPtr(library->newFunction(nsVertName));
NS::SharedPtr<MTL::Function> vertexFunction = NS::TransferPtr(library->newFunction(nsVertName));
if (!vertexFunction) {
Log::Error(Event::Shader, name + " missing vertex function " + vertexName.data());
assert(false);
Expand All @@ -146,7 +146,7 @@ UniqueShaderProgram Context::createProgram(std::string name,
NS::SharedPtr<MTL::Function> fragmentFunction;
if (!fragmentName.empty()) {
const auto nsFragName = NS::String::string(fragmentName.data(), NS::UTF8StringEncoding);
fragmentFunction = NS::RetainPtr(library->newFunction(nsFragName));
fragmentFunction = NS::TransferPtr(library->newFunction(nsFragName));
if (!fragmentFunction) {
Log::Error(Event::Shader, name + " missing fragment function " + fragmentName.data());
assert(false);
Expand Down
Loading