Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 00:40:13 +0000



Post From: Access data using GDIFunction DrawToChart()

[2024-01-19 20:55:20]
User719512 - Posts: 264
Try using new/delete. You don't need to use the sc heap apis.


if (sc.LastCallToFunction)
{
if (tpoMap != NULL)
{
delete tpoMap;
sc.SetPersistentPointer(1, NULL);
tpoMap = NULL; // not needed, but good pattern!
}

return;
}

...
if (tpoMap == NULL)
{
// allocate memory
tpoMap = new std::map<float, char>;
if (topMap != NULL)
sc.SetPersistentPointer(1, tpoMap);
else
return;
}
...
// at this point, we know tpoMap is a valid pointer
...



your code also seems to have a logic error. If you just allocated/new the map, it will not have anything to find. that logic should probably be its own block outside allocation.
Date Time Of Last Edit: 2024-01-19 21:05:12