Skip to content

Commit 443711e

Browse files
committed
fix: Correct things by removing static.
1 parent 3361c2d commit 443711e

File tree

7 files changed

+17
-22
lines changed

7 files changed

+17
-22
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:1cf75b756d44f6fe58b2d719d08090985c247268955622876fcb60cfc77ed8dc
2+
oid sha256:7fcda0ad1d1c7161ac841a671ea39f8be6f0cba0b19d9ae1bfd01e1aca774226
33
size 122880
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ef269c1c32a82d5894f6ca1cd5c830798983b61f7dbcd93e6526d591d033c659
3-
size 592384
2+
oid sha256:8ffbe8196e9dc6bd0ef753dbdd673d757be608c1f0ccf38c099479cc869ad153
3+
size 593408
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:56b49bdbfa321c755adbba73eb4cbccce840024e698405db15b82d882f5da912
2+
oid sha256:512b26660b493f0108cafb2e8cf27bdac0f5d4cacb4648bac674cbc8c5d76557
33
size 87040
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:e40d96838339aa9db1faa6ea8e7a8006cf9225838fcc52ba245daf7ab50929fd
3-
size 457216
2+
oid sha256:6aae5d540a3b2b4f82000ef3cbc36b6262e7d42f4eea623b98622b57a185900d
3+
size 457728

lib/NativeCode/DynamicLibraryLoaderHelper/NativeRender/include/Config/PlatformConfig.hpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ namespace pew::eos::config
141141
return cache_directory.c_str();
142142
}
143143

144-
EOS_Platform_RTCOptions* get_platform_rtc_options() const
144+
std::shared_ptr<EOS_Platform_RTCOptions> get_platform_rtc_options() const
145145
{
146146
return rtc_options;
147147
}
@@ -164,7 +164,7 @@ namespace pew::eos::config
164164
/**
165165
* \brief Used to store the rtc options once it has been determined.
166166
*/
167-
EOS_Platform_RTCOptions* rtc_options;
167+
std::shared_ptr<EOS_Platform_RTCOptions> rtc_options;
168168

169169
explicit PlatformConfig(const char* file_name) : Config(file_name),
170170
is_server(false),
@@ -176,7 +176,6 @@ namespace pew::eos::config
176176
initial_button_delay_for_overlay(0),
177177
repeat_button_delay_for_overlay(0)
178178
{
179-
initialize();
180179
}
181180

182181
void parse_json_element(const std::string& name, json_value_s& value) override
@@ -285,29 +284,23 @@ namespace pew::eos::config
285284

286285
friend struct Config;
287286

288-
virtual ~PlatformConfig()
287+
void initialize()
289288
{
290-
// Free the dynamically allocated memory for the rtc options
291-
delete rtc_options;
292-
};
289+
set_platform_rtc_options();
290+
set_cache_directory();
291+
}
293292

294293
private:
295294

296295
void set_platform_rtc_options()
297296
{
298297
if (rtc_options == nullptr)
299298
{
300-
rtc_options = new EOS_Platform_RTCOptions();
299+
rtc_options = std::make_shared<EOS_Platform_RTCOptions>();
301300
rtc_options->ApiVersion = EOS_PLATFORM_RTCOPTIONS_API_LATEST;
302301
set_platform_specific_rtc_options();
303302
}
304303
}
305-
306-
void initialize()
307-
{
308-
set_platform_rtc_options();
309-
set_cache_directory();
310-
}
311304
};
312305
}
313306

lib/NativeCode/DynamicLibraryLoaderHelper/NativeRender/include/Config/WindowsConfig.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace pew::eos::config
3131
{
3232
struct WindowsConfig final : PlatformConfig
3333
{
34-
~WindowsConfig() override
34+
~WindowsConfig()
3535
{
3636
delete static_cast<EOS_Windows_RTCOptions*>(platform_specific_rtc_options);
3737
}
@@ -90,7 +90,9 @@ namespace pew::eos::config
9090

9191
explicit WindowsConfig() : PlatformConfig("eos_windows_config.json")
9292
{
93+
initialize();
9394
}
95+
9496
// Makes the WindowsConfig constructor accessible to the Config class.
9597
friend struct Config;
9698
};

lib/NativeCode/DynamicLibraryLoaderHelper/NativeRender/src/eos_helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ namespace pew::eos
371371
platform_options.TaskNetworkTimeoutSeconds = &task_network_timeout_seconds_dbl;
372372
}
373373

374-
platform_options.RTCOptions = platform_config.get_platform_rtc_options();
374+
platform_options.RTCOptions = platform_config.get_platform_rtc_options().get();
375375

376376
// TODO-STEAM: enable apply_steam_settings(platform_options);
377377

0 commit comments

Comments
 (0)