QWaylandShmBuffer: don't ignore the result of Q(Temporary)File::open()
The code checked isOpen() afterwards, so everything was ok, but the compiler still complained with QFile::open()-turned-nodiscard-in-6.10. Use a boolean to store the result of open() and use it in lieu of isOpen(). Amends 32daa1a5b9ac06ae89d3aab5b4638139e72814e2. Pick-to: 6.9 6.8 Change-Id: Ia7db2505e939e4f4614cfc8319e779812dd17353 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a6059d4371
commit
138c43a321
@ -60,19 +60,20 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display,
|
||||
#endif
|
||||
|
||||
QScopedPointer<QFile> filePointer;
|
||||
bool opened;
|
||||
|
||||
if (fd == -1) {
|
||||
auto tmpFile = new QTemporaryFile (QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) +
|
||||
QLatin1String("/wayland-shm-XXXXXX"));
|
||||
tmpFile->open();
|
||||
opened = tmpFile->open();
|
||||
filePointer.reset(tmpFile);
|
||||
} else {
|
||||
auto file = new QFile;
|
||||
file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle);
|
||||
opened = file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle);
|
||||
filePointer.reset(file);
|
||||
}
|
||||
// NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does.
|
||||
if (!filePointer->isOpen() || !filePointer->resize(alloc)) {
|
||||
if (!opened || !filePointer->resize(alloc)) {
|
||||
qWarning("QWaylandShmBuffer: failed: %s", qUtf8Printable(filePointer->errorString()));
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user