1
\$\begingroup\$

Hello I'm using SDL with C++ and I got this code:

void handleEvents() {
    SDL_Finger* finger = SDL_GetTouchFinger(SDL_GetTouchDevice(0), 0);
}

I do not know what SDL does inside the GetTouch function, maybe it allocates memory. Do I have to "destroy" finger here? Or will it be deleted by the end of the methods scope? Thank you.

\$\endgroup\$
3
\$\begingroup\$

From a quick glance at the SDL wiki at the function you provided, it says:

"The returned resource is owned by SDL and should not be deallocated."

from - https://wiki.libsdl.org/SDL_GetTouchFinger

Therefor, you shouldn't need to worry about destroying the object, SDL will manage it for you.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.