diff --git a/Telegram/Patches/qtbase_5_6_0.diff b/Telegram/Patches/qtbase_5_6_0.diff index dd4c477bf..e1e270564 100644 --- a/Telegram/Patches/qtbase_5_6_0.diff +++ b/Telegram/Patches/qtbase_5_6_0.diff @@ -11300,6 +11300,34 @@ index ca92103..225d85f 100644 QPainter p(&m_qImage); p.setCompositionMode(QPainter::CompositionMode_Source); const QVector rects = region.rects(); +diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm +index 6bec6b1..f14d6ee 100644 +--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm ++++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm +@@ -422,14 +422,20 @@ void QCocoaIntegration::updateScreens() + } + siblings << screen; + } ++ ++ ++// Patch: backport crash fix from Qt 5.6.1 ++ // Set virtual siblings list. All screens in mScreens are siblings, because we ignored the ++ // mirrors. Note that some of the screens we update the siblings list for here may be deleted ++ // below, but update anyway to keep the to-be-deleted screens out of the siblings list. ++ foreach (QCocoaScreen* screen, mScreens) ++ screen->setVirtualSiblings(siblings); ++ + // Now the leftovers in remainingScreens are no longer current, so we can delete them. + foreach (QCocoaScreen* screen, remainingScreens) { + mScreens.removeOne(screen); + destroyScreen(screen); + } +- // All screens in mScreens are siblings, because we ignored the mirrors. +- foreach (QCocoaScreen* screen, mScreens) +- screen->setVirtualSiblings(siblings); + } + + QCocoaScreen *QCocoaIntegration::screenAtIndex(int index) diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.mm b/src/plugins/platforms/cocoa/qcocoakeymapper.mm index c2d206f..0f9b512 100644 --- a/src/plugins/platforms/cocoa/qcocoakeymapper.mm diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp index 32f2f79b9..f16d9de2a 100644 --- a/Telegram/SourceFiles/media/media_audio.cpp +++ b/Telegram/SourceFiles/media/media_audio.cpp @@ -1984,7 +1984,7 @@ public: int64 samples = 0; auto res = readMore(buffer, samples); - if (res == ReadResult::Error) { + if (res == ReadResult::Error || res == ReadResult::EndOfFile) { break; } if (buffer.isEmpty()) { diff --git a/Telegram/SourceFiles/media/media_clip_ffmpeg.cpp b/Telegram/SourceFiles/media/media_clip_ffmpeg.cpp index acf016310..5fd4f0bae 100644 --- a/Telegram/SourceFiles/media/media_clip_ffmpeg.cpp +++ b/Telegram/SourceFiles/media/media_clip_ffmpeg.cpp @@ -52,7 +52,7 @@ ReaderImplementation::ReadResult FFMpegReaderImplementation::readNextFrame() { if (res == AVERROR_EOF) { clearPacketQueue(); if (_mode == Mode::Normal) { - return ReadResult::Eof; + return ReadResult::EndOfFile; } if ((res = avformat_seek_file(_fmtContext, _streamId, std::numeric_limits::min(), 0, std::numeric_limits::max(), 0)) < 0) { diff --git a/Telegram/SourceFiles/media/media_clip_implementation.h b/Telegram/SourceFiles/media/media_clip_implementation.h index 54bf98944..303c8ee2a 100644 --- a/Telegram/SourceFiles/media/media_clip_implementation.h +++ b/Telegram/SourceFiles/media/media_clip_implementation.h @@ -41,7 +41,7 @@ public: enum class ReadResult { Success, Error, - Eof, + EndOfFile, }; // Read frames till current frame will have presentation time > frameMs, systemMs = getms(). virtual ReadResult readFramesTill(int64 frameMs, uint64 systemMs) = 0; diff --git a/Telegram/SourceFiles/media/media_clip_qtgif.cpp b/Telegram/SourceFiles/media/media_clip_qtgif.cpp index 18f0462b5..b5209d0cc 100644 --- a/Telegram/SourceFiles/media/media_clip_qtgif.cpp +++ b/Telegram/SourceFiles/media/media_clip_qtgif.cpp @@ -55,7 +55,7 @@ ReaderImplementation::ReadResult QtGifReaderImplementation::readNextFrame() { if (_reader) _frameDelay = _reader->nextImageDelay(); if (_framesLeft < 1) { if (_mode == Mode::Normal) { - return ReadResult::Eof; + return ReadResult::EndOfFile; } else if (!jumpToStart()) { return ReadResult::Error; } diff --git a/Telegram/SourceFiles/media/media_clip_reader.cpp b/Telegram/SourceFiles/media/media_clip_reader.cpp index 043d149e3..f310dd1b9 100644 --- a/Telegram/SourceFiles/media/media_clip_reader.cpp +++ b/Telegram/SourceFiles/media/media_clip_reader.cpp @@ -346,7 +346,7 @@ public: } if (frame() && frame()->original.isNull()) { auto readResult = _implementation->readFramesTill(-1, ms); - if (readResult == internal::ReaderImplementation::ReadResult::Eof && _seekPositionMs > 0) { + if (readResult == internal::ReaderImplementation::ReadResult::EndOfFile && _seekPositionMs > 0) { // If seek was done to the end: try to read the first frame, // get the frame size and return a black frame with that size. @@ -414,7 +414,7 @@ public: ProcessResult finishProcess(uint64 ms) { auto frameMs = _seekPositionMs + ms - _animationStarted; auto readResult = _implementation->readFramesTill(frameMs, ms); - if (readResult == internal::ReaderImplementation::ReadResult::Eof) { + if (readResult == internal::ReaderImplementation::ReadResult::EndOfFile) { stop(); _state = State::Finished; return ProcessResult::Finished;