Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 6th December 2012, 13:50   #1
griffins_Grader
Senior Member
 
Join Date: Aug 2008
Posts: 114
ML_IPC_DB_FREEQUERYRESULTSW corrupts Variable (RUNTIME CHECK FAILURE #2)

in itemRecordW struct I assign a value to some wchar_t items in the struct however, I get a runtime check failure when I call ML_IPC_DB_FREEQUERYRESULTSW. For example if I would do something like:

TCHAR newartist[256]={0}
wcscpy_s(newartist,256,L"some-artist",)
mlQueryStructW.results.Items->artist = newartist;

I will call ML_IPC_DB_UPDATEITEMW and then call ML_IPC_DB_FREEQUERYRESULTSW this will corrupt newartist. So I came up with allocating space before using the variable as in:

TCHAR * newartist = new TCHAR[256];
wcscpy_s(newartist,256,L"some-artist",)
mlQueryStructW.results.Items->artist = newartist;
call ML_IPC_DB_UPDATEITEMW then
delete [] newartist
call ML_IPC_DB_FREEQUERYRESULTSW

This seem to alleviate the problem. The question that comes to my mind is should I delete newartist or let ML_IPC_DB_FREEQUERYRESULTSW do it? If I delete newartist winamp triggers a breakpoint in the debugger.
griffins_Grader is offline   Reply With Quote
Old 27th March 2013, 20:43   #2
Benski
Ben Allison
Former Winamp Developer
 
Benski's Avatar
 
Join Date: Jan 2005
Location: Brooklyn, NY
Posts: 1,057
This API is meant for itemRecordListW objects that you received directly from Winamp API and have left unmodified. If you are making your own itemRecordW or itemRecordListW objects, you should not call this API. If you receive an itemRecordW from Winamp and wish to make changes, you should make a complete copy using your own memory.
Benski is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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