Skip to content

Commit 0b7042a

Browse files
MacOS App: do not manually release process arguments as they are autoreleased
Fix DiligentGraphics/DiligentSamples#228
1 parent 1716841 commit 0b7042a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

NativeApp/Apple/Source/Classes/OSX/ViewBase.mm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/* Copyright 2015-2019 Egor Yusov
1+
/*
2+
* Copyright 2025 Diligent Graphics LLC
3+
* Copyright 2015-2019 Egor Yusov
24
*
35
* Licensed under the Apache License, Version 2.0 (the "License");
46
* you may not use this file except in compliance with the License.
@@ -46,18 +48,17 @@ - (void) awakeFromNib
4648
std::vector<std::string> ArgStr;
4749
@autoreleasepool
4850
{
49-
NSArray<NSString*>* arguments = [[NSProcessInfo processInfo] arguments];
51+
NSArray<NSString*>* arguments = [[NSProcessInfo processInfo] arguments]; // Autoreleased
5052
const auto ArgCount = arguments.count;
5153
Args.resize(ArgCount);
5254
ArgStr.resize(ArgCount);
5355
for(size_t i = 0; i < ArgCount; ++i)
5456
{
55-
ArgStr[i] = [arguments[i] cStringUsingEncoding:NSUTF8StringEncoding];
57+
ArgStr[i] = [arguments[i] cStringUsingEncoding:NSUTF8StringEncoding]; // Autoreleased
5658
Args[i] = ArgStr[i].c_str();
5759
}
58-
[arguments release];
5960
}
60-
61+
6162
_theApp.reset(Diligent::CreateApplication());
6263
_theApp->ProcessCommandLine(static_cast<int>(Args.size()), Args.data());
6364

0 commit comments

Comments
 (0)