Fixed client side waveform counter infinite loop.

Backported Qt 5.6.1 crash fix in cocoa integration to Qt patch.
This commit is contained in:
John Preston 2016-07-30 11:03:44 +01:00
parent 0291888c01
commit d31701e906
6 changed files with 34 additions and 6 deletions

View File

@ -11300,6 +11300,34 @@ index ca92103..225d85f 100644
QPainter p(&m_qImage);
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> 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

View File

@ -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()) {

View File

@ -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<int64_t>::min(), 0, std::numeric_limits<int64_t>::max(), 0)) < 0) {

View File

@ -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;

View File

@ -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;
}

View File

@ -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;