在 SDL 中,我是否需要释放从 SDL_GetWindowSurface 获得的表面?

In SDL, do I need to free the surface I got from SDL_GetWindowSurface?

在 SDL 中,当我用 SDL_DestroyWindow 销毁 window 时,是否还需要调用 SDL_FreeSurface 来释放与 window 关联的表面?

SDL_Window *window = SDL_CreateWindow(/*...*/);
SDL_Surface *wsurface = SDL_GetWindowSurface(window);
/*...*/
SDL_FreeSurface(wsurface); /* <- do I also need this line? */
SDL_DestroyWindow(window);

我不清楚表面是需要手动释放还是在我销毁 window 时自动释放。

它会自动释放。这是相关的 documentation:

A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed. Do not free this surface.