add some notes deleting some handles returned from natives

This commit is contained in:
rtldg 2021-12-29 19:31:12 +00:00
parent ede141d8c0
commit 426d6af3c5
5 changed files with 7 additions and 10 deletions

View File

@ -52,14 +52,14 @@ forward void SMC_OnSuccesfulRTV();
/** /**
* Returns the ArrayList of maps currently on rotation. * Returns the ArrayList of maps currently on rotation.
* *
* @return The ArrayList of Maps * @return The ArrayList of Maps. Don't delete this handle.
*/ */
native ArrayList Shavit_GetMapsArrayList(); native ArrayList Shavit_GetMapsArrayList();
/** /**
* Returns the StringMap of maps currently on rotation. * Returns the StringMap of maps currently on rotation.
* *
* @return the StringMap of maps * @return the StringMap of maps. Don't delete this handle.
*/ */
native StringMap Shavit_GetMapsStringMap(); native StringMap Shavit_GetMapsStringMap();

View File

@ -215,7 +215,8 @@ native int Shavit_GetReplayCachePostFrames(int bot);
* @param style Style. * @param style Style.
* @param track Track. * @param track Track.
* @param cheapCloneHandle False means we duplicate the frames (ArrayList.Clone). True means we clone the handle to the frames (CloneHandle). * @param cheapCloneHandle False means we duplicate the frames (ArrayList.Clone). True means we clone the handle to the frames (CloneHandle).
* @return ArrayList with proper replay data, or null if there is no recorded data. *
* @return ArrayList with proper replay data, or null if there is no recorded data. Delete this handle when you're done with it.
*/ */
native ArrayList Shavit_GetReplayFrames(int style, int track, bool cheapCloneHandle=false); native ArrayList Shavit_GetReplayFrames(int style, int track, bool cheapCloneHandle=false);

View File

@ -121,7 +121,7 @@ native void Shavit_SetReplayData(int client, ArrayList data, bool cheapCloneHand
* @param client Client index. * @param client Client index.
* @param cheapCloneHandle False means we duplicate the frames (Arraylist.Clone). True means we clone the handle to the frames (CloneHandle). This is going to be used for peristent-data in shavit-misc so we don't allocate duplicate memory needlessly. * @param cheapCloneHandle False means we duplicate the frames (Arraylist.Clone). True means we clone the handle to the frames (CloneHandle). This is going to be used for peristent-data in shavit-misc so we don't allocate duplicate memory needlessly.
* *
* @return ArrayList with proper replay data, or null if the player has no recorded data. * @return ArrayList with proper replay data, or null if the player has no recorded data. Delete this handle when you're done with it.
*/ */
native ArrayList Shavit_GetReplayData(int client, bool cheapCloneHandle=false); native ArrayList Shavit_GetReplayData(int client, bool cheapCloneHandle=false);

View File

@ -2315,10 +2315,10 @@ void DebugPrint(const char[] message, any ...)
public any Native_GetMapsArrayList(Handle plugin, int numParams) public any Native_GetMapsArrayList(Handle plugin, int numParams)
{ {
return CloneHandle(g_aMapList, plugin); return g_aMapList;
} }
public any Native_GetMapsStringMap(Handle plugin, int numParams) public any Native_GetMapsStringMap(Handle plugin, int numParams)
{ {
return CloneHandle(g_mMapList, plugin); return g_mMapList;
} }

View File

@ -821,8 +821,6 @@ public void OpenStatsMenu_Mapchooser_Callback(Database db, DBResultSet results,
maps_and_completions[blah][track>0?1:0] += 1; maps_and_completions[blah][track>0?1:0] += 1;
} }
delete mapchooser_maps;
data.WriteCell(maps_and_completions[0][0], true); data.WriteCell(maps_and_completions[0][0], true);
data.WriteCell(maps_and_completions[0][1], true); data.WriteCell(maps_and_completions[0][1], true);
data.WriteCell(maps_and_completions[1][0], true); data.WriteCell(maps_and_completions[1][0], true);
@ -1271,8 +1269,6 @@ public void ShowMapsCallback(Database db, DBResultSet results, const char[] erro
menu.AddItem(sRecordID, sDisplay); menu.AddItem(sRecordID, sDisplay);
} }
delete mapchooser_maps;
if(gI_MapType[client] == MAPSDONE) if(gI_MapType[client] == MAPSDONE)
{ {
menu.SetTitle("%T (%s)", "MapsDoneFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack); menu.SetTitle("%T (%s)", "MapsDoneFor", client, gS_StyleStrings[gI_Style[client]].sShortName, gS_TargetName[client], rows, sTrack);