Verified Commit fc1ac77f authored by Jonah Brüchert's avatar Jonah Brüchert 💬
Browse files

Work around crash in the QrCodeDecoder

This would need a larger restructuring to be fixed properly.
Instead of returning through emitting a signal, this should go through QFuture.
parent abd7b515
Pipeline #83271 passed with stage
in 2 minutes and 36 seconds
......@@ -74,6 +74,15 @@ void QrCodeDecoder::decodeImage(const QImage &image)
const auto result = MultiFormatReader(decodeHints).read(binImage);
#endif
// FIXME: `this` is not supposed to become nullptr in well-defined C++ code,
// so if we are unlucky, the compiler may optimize the entire check away.
// Additionally, this could be racy if the object is deleted on the other thread
// in between this check and the emit.
const auto *self = this;
if (!self) {
return;
}
// If a QR code could be found and decoded, emit a signal with the decoded string.
// Otherwise, emit a signal for failed decoding.
if (result.isValid())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment