Old 05-20-2019, 09:23 AM   #1
Human being with feelings
Join Date: Nov 2018
Posts: 3
Default MediaTracks persisting after 'New' -- Solved


After a fair bit of investigation, I realised this wasn't actually a bug. The same memory location that our MediaTrack pointer pointed to was being reused before we'd realised the original MediaTrack had been deleted in the meantime.

The solution is to store GUIDs (GetTrackGUID) alongside the MediaTrack pointer, and then by comparing GUIDs before working with the MediaTrack, you can be sure that the pointer is still pointing to the same track.



I am writing an extension in C++. As part of it's job, it creates MediaTracks and stores a pointer to them. Before I do any other operations on the MediaTrack, I check to make sure it still exists (the user may have deleted the track, or started a new project.) However, sometimes the API functions behave as though the track still exists after I have started a new project.

When this occurs, both ValidatePtr and ValidatePtr2 return true, GetMediaTrackInfo_Value(trk, "IP_TRACKNUMBER") returns > 0.0, and I can run other commands such as GetMediaTrackInfo_Value(trk, "B_SHOWINTCP") and GetMediaTrackInfo_Value(trk, "I_NCHAN") which return valid values.

This was spotted on Windows 10 Pro, with Reaper x64 v5.978

Last edited by matt_f; 05-21-2019 at 06:48 AM. Reason: Not a bug
matt_f is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 07:09 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.