瀏覽代碼

test: Fix popup test crash on exit

If the done signal is emitted by the common event handler, the window and all of its children have already been destroyed, so don't try to render with invalid renderer objects.
Frank Praznik 2 年之前
父節點
當前提交
21ff699251
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      test/testpopup.c

+ 4 - 0
test/testpopup.c

@@ -188,6 +188,10 @@ static void loop(void)
         SDLTest_CommonEvent(state, &event, &done);
         SDLTest_CommonEvent(state, &event, &done);
     }
     }
 
 
+    if (done) {
+        return;
+    }
+
     /* Show the tooltip if the delay period has elapsed */
     /* Show the tooltip if the delay period has elapsed */
     if (SDL_GetTicks() > tooltip_timer) {
     if (SDL_GetTicks() > tooltip_timer) {
         if (tooltip.win == NULL) {
         if (tooltip.win == NULL) {