Skip to content

Commit

Permalink
Destroy QPlatformWindow if QWindow wasn't existing before CheckCapaib…
Browse files Browse the repository at this point in the history
…lities
  • Loading branch information
ilya-fedin authored and john-preston committed Sep 19, 2024
1 parent 169128a commit 1dec2a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/gl/gl_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,15 @@ Capabilities CheckCapabilities(QWidget *widget) {
auto format = tester.format();
format.setAlphaBufferSize(8);
tester.setFormat(format);
if (!tester.window()->windowHandle()) {
tester.window()->createWinId();
}
const auto guard2 = [&]() -> std::optional<gsl::final_action<Fn<void()>>> {
if (!tester.window()->windowHandle()) {
tester.window()->createWinId();
return gsl::finally(Fn<void()>([&] {
tester.window()->windowHandle()->destroy();
}));
}
return std::nullopt;
}();
tester.grabFramebuffer(); // Force initialize().

const auto context = tester.context();
Expand Down

0 comments on commit 1dec2a1

Please sign in to comment.