Page MenuHomeFeedback Tracker

When string is assembled in call to GetGame().GetWorkspace().CreateWidgets, it sometimes fails
Assigned, NormalPublic

Description

When the path to the layout file is dynamically assembled directly in the call to CreateWidgets, it sometimes fails to create widgets (returned widget is either NULL or not of the expected type).

Sporadically failing example:

Widget widget = GetGame().GetWorkspace().CreateWidgets( "path/to/layoutfiles/" + rows.ToString() + "/GridSpacer" + columns.ToString() + ".layout", parent );

The work-around is to assemble the path outside the call, and then passing it in:

Working example:

string layout = "path/to/layoutfiles/" + rows.ToString() + "/GridSpacer" + columns.ToString() + ".layout";
Widget widget = GetGame().GetWorkspace().CreateWidgets( layout, parent );

Details

Severity
None
Resolution
Open
Reproducibility
Sometimes
Operating System
Windows 10 x64
Category
Modding

Event Timeline

lava76 created this task.Aug 3 2024, 1:31 PM
lava76 updated the task description. (Show Details)Aug 3 2024, 1:38 PM
Geez changed the task status from New to Assigned.Aug 5 2024, 11:11 AM
lava76 added a comment.Aug 9 2024, 5:59 PM

It seems the underlying issue might be some sort of memory corruption. I'm attaching a crashlog + minidump in case it's helpful.