tolk icon indicating copy to clipboard operation
tolk copied to clipboard

Memory behavior of functions taking wchar_t pointers is not documented

Open realnc opened this issue 8 years ago • 1 comments

Hello, and thanks for this library!

One thing that is not clear in the API, is who's responsible for the wchar_t* data passed to the various functions. For example, does Tolk_Output() take ownership? Should I delete it? Is it copied? In other words:

auto buf = new wchar_t[txt_len];
// ...
Talk_Output(buf);
delete[] buf; // Is this safe? Is Talk_Output() going to read from the deleted buffer?

realnc avatar Nov 09 '17 05:11 realnc

Fair point, will see what I can do about it. In short, Tolk either creates a string for use with COM and passes that on to the screen reader, or it passes the string on directly. In the latter case the screen reader API ought to document its behavior. I don't think all of them do.

dkager avatar Nov 09 '17 06:11 dkager