Skip to content

Commit

Permalink
ISceneViewExtensions: Call constructors on FMalloc variant
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jul 23, 2024
1 parent cdeff49 commit c8a58af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3494,6 +3494,9 @@ bool FFakeStereoRenderingHook::setup_view_extensions() try {
} else {
if (auto fmalloc = sdk::FMalloc::get(); fmalloc != nullptr) {
exts.data = (TWeakPtr<ISceneViewExtension>*)fmalloc->malloc(new_capacity * sizeof(TWeakPtr<ISceneViewExtension>));
for (auto i = 0; i < new_capacity; ++i) {
new (&exts.data[i]) TWeakPtr<ISceneViewExtension>();
}
} else {
SPDLOG_ERROR("Failed to get FMalloc! Cannot allocate new view extensions array! Falling back to default allocation method...");
exts.data = new TWeakPtr<ISceneViewExtension>[new_capacity]{};
Expand Down Expand Up @@ -3522,6 +3525,9 @@ bool FFakeStereoRenderingHook::setup_view_extensions() try {
} else {
if (auto fmalloc = sdk::FMalloc::get(); fmalloc != nullptr) {
new_exts = (TWeakPtr<ISceneViewExtension>*)fmalloc->malloc(new_capacity * sizeof(TWeakPtr<ISceneViewExtension>));
for (auto i = 0; i < new_capacity; ++i) {
new (&new_exts[i]) TWeakPtr<ISceneViewExtension>();
}
} else {
SPDLOG_ERROR("Failed to get FMalloc! Cannot allocate new view extensions array! Falling back to default allocation method...");
new_exts = new TWeakPtr<ISceneViewExtension>[new_capacity];
Expand Down

0 comments on commit c8a58af

Please sign in to comment.