Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c81b5324 authored by Yiwei Zhang's avatar Yiwei Zhang
Browse files

libvulkan: add a nullptr check for ANativeWindow*

When VK_GOOGLE_display_timing extension is in use, if the swapchain is
not in active status, during vkDestroySwapchainKHR, a nullptr checker
for the ANativeWindow* is missing and that will cause a crashing when
calling window api with window being nullptr. This change just adds a
nullptr check for that ANativeWindow*.

Bug: 134185757
Test: manual
Change-Id: Ica4543666c4aadc0a4d9a6caddaefd4ab08f8627
Merged-In: Ic8a4baf7e219cc8e1fb3838d4e4b710b242efa9c
parent 8475fc34
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1306,7 +1306,7 @@ void DestroySwapchainKHR(VkDevice device,
    bool active = swapchain->surface.swapchain_handle == swapchain_handle;
    bool active = swapchain->surface.swapchain_handle == swapchain_handle;
    ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;
    ANativeWindow* window = active ? swapchain->surface.window.get() : nullptr;


    if (swapchain->frame_timestamps_enabled) {
    if (window && swapchain->frame_timestamps_enabled) {
        native_window_enable_frame_timestamps(window, false);
        native_window_enable_frame_timestamps(window, false);
    }
    }
    for (uint32_t i = 0; i < swapchain->num_images; i++)
    for (uint32_t i = 0; i < swapchain->num_images; i++)