mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +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_download_manager.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "main/main_session.h"
|
||||
|
||||
FileClickHandler::FileClickHandler(FullMsgId context)
|
||||
: _context(context) {
|
||||
|
@ -79,7 +80,14 @@ void DocumentSaveClickHandler::Save(
|
|||
}
|
||||
|
||||
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()) {
|
||||
return;
|
||||
}
|
||||
|
@ -92,16 +100,15 @@ void DocumentSaveClickHandler::Save(
|
|||
const auto filename = filepath.isEmpty()
|
||||
? QString()
|
||||
: fileinfo.fileName();
|
||||
savename = DocumentFileNameForSave(
|
||||
const auto savename = DocumentFileNameForSave(
|
||||
data,
|
||||
(mode == Mode::ToNewFile),
|
||||
filename,
|
||||
filedir);
|
||||
if (savename.isEmpty()) {
|
||||
return;
|
||||
if (!savename.isEmpty()) {
|
||||
data->save(origin, savename);
|
||||
}
|
||||
}
|
||||
data->save(origin, savename);
|
||||
}));
|
||||
}
|
||||
|
||||
void DocumentSaveClickHandler::SaveAndTrack(
|
||||
|
|
Loading…
Add table
Reference in a new issue