mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix possible crash in media viewer hide workaround.
This commit is contained in:
parent
a6fb0e372e
commit
401529e7d1
1 changed files with 12 additions and 9 deletions
|
@ -4517,17 +4517,20 @@ void OverlayWidget::applyHideWindowWorkaround() {
|
||||||
// So on next paint we force full backing store repaint.
|
// So on next paint we force full backing store repaint.
|
||||||
if (_opengl && !isHidden() && !_hideWorkaround) {
|
if (_opengl && !isHidden() && !_hideWorkaround) {
|
||||||
_hideWorkaround = std::make_unique<Ui::RpWidget>(_widget);
|
_hideWorkaround = std::make_unique<Ui::RpWidget>(_widget);
|
||||||
_hideWorkaround->setGeometry(_widget->rect());
|
const auto raw = _hideWorkaround.get();
|
||||||
_hideWorkaround->show();
|
raw->setGeometry(_widget->rect());
|
||||||
_hideWorkaround->paintRequest(
|
raw->show();
|
||||||
|
raw->paintRequest(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
const auto workaround = _hideWorkaround.release();
|
if (_hideWorkaround.get() == raw) {
|
||||||
QPainter(workaround).fillRect(workaround->rect(), QColor(0, 1, 0, 1));
|
_hideWorkaround.release();
|
||||||
crl::on_main(workaround, [=] {
|
}
|
||||||
delete workaround;
|
QPainter(raw).fillRect(raw->rect(), QColor(0, 1, 0, 1));
|
||||||
|
crl::on_main(raw, [=] {
|
||||||
|
delete raw;
|
||||||
});
|
});
|
||||||
}, _hideWorkaround->lifetime());
|
}, raw->lifetime());
|
||||||
_hideWorkaround->update();
|
raw->update();
|
||||||
|
|
||||||
if (Platform::IsWindows()) {
|
if (Platform::IsWindows()) {
|
||||||
Ui::Platform::UpdateOverlayed(_widget);
|
Ui::Platform::UpdateOverlayed(_widget);
|
||||||
|
|
Loading…
Add table
Reference in a new issue