stw_st_destroy_framebuffer_locked(fb->stfb);
- ReleaseDC(fb->hWnd, fb->hDC);
-
pipe_mutex_unlock( fb->mutex );
pipe_mutex_destroy( fb->mutex );
if (fb == NULL)
return NULL;
- /* Applications use, create, destroy device contexts, so the hdc passed is. We create our own DC
- * because we need one for single buffered visuals.
- */
- fb->hDC = GetDC(hWnd);
-
fb->hWnd = hWnd;
fb->iPixelFormat = iPixelFormat;
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
+ boolean ret;
+ HDC hDC;
pipe_mutex_lock(stwfb->fb->mutex);
- return stw_st_framebuffer_present_locked(stwfb->fb->hDC, &stwfb->base, statt);
+ /* We must not cache HDCs anywhere, as they can be invalidated by the
+ * application, or screen resolution changes. */
+
+ hDC = GetDC(stwfb->fb->hWnd);
+
+ ret = stw_st_framebuffer_present_locked(hDC, &stwfb->base, statt);
+
+ ReleaseDC(stwfb->fb->hWnd, hDC);
+
+ return ret;
}
/**