mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Call file dialog from InvokeQueued.
Otherwise for some reason timerEvent-s stop being delivered on the background thread that processes audio data from the voice chat. Fixes #24002.
This commit is contained in:
parent
bc523c2685
commit
19d5b17d2e
1 changed files with 13 additions and 6 deletions
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_download_manager.h"
|
#include "data/data_download_manager.h"
|
||||||
#include "data/data_photo.h"
|
#include "data/data_photo.h"
|
||||||
|
#include "main/main_session.h"
|
||||||
|
|
||||||
FileClickHandler::FileClickHandler(FullMsgId context)
|
FileClickHandler::FileClickHandler(FullMsgId context)
|
||||||
: _context(context) {
|
: _context(context) {
|
||||||
|
@ -79,7 +80,14 @@ void DocumentSaveClickHandler::Save(
|
||||||
}
|
}
|
||||||
|
|
||||||
auto savename = QString();
|
auto savename = QString();
|
||||||
if (mode != Mode::ToCacheOrFile || !data->saveToCache()) {
|
if (mode == Mode::ToCacheOrFile && data->saveToCache()) {
|
||||||
|
data->save(origin, savename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InvokeQueued(qApp, crl::guard(&data->session(), [=] {
|
||||||
|
// If we call file dialog synchronously, it will stop
|
||||||
|
// background thread timers from working which would
|
||||||
|
// stop audio playback in voice chats / live streams.
|
||||||
if (mode != Mode::ToNewFile && data->saveFromData()) {
|
if (mode != Mode::ToNewFile && data->saveFromData()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -92,16 +100,15 @@ void DocumentSaveClickHandler::Save(
|
||||||
const auto filename = filepath.isEmpty()
|
const auto filename = filepath.isEmpty()
|
||||||
? QString()
|
? QString()
|
||||||
: fileinfo.fileName();
|
: fileinfo.fileName();
|
||||||
savename = DocumentFileNameForSave(
|
const auto savename = DocumentFileNameForSave(
|
||||||
data,
|
data,
|
||||||
(mode == Mode::ToNewFile),
|
(mode == Mode::ToNewFile),
|
||||||
filename,
|
filename,
|
||||||
filedir);
|
filedir);
|
||||||
if (savename.isEmpty()) {
|
if (!savename.isEmpty()) {
|
||||||
return;
|
data->save(origin, savename);
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
data->save(origin, savename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentSaveClickHandler::SaveAndTrack(
|
void DocumentSaveClickHandler::SaveAndTrack(
|
||||||
|
|
Loading…
Add table
Reference in a new issue