diff --git a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp index bdac6dc2416..b1ae2e1ae4f 100644 --- a/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmbackingstore.cpp @@ -16,6 +16,8 @@ #include +#include + #include #include #include @@ -59,18 +61,19 @@ QWaylandShmBuffer::QWaylandShmBuffer(QWaylandDisplay *display, fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); #endif - QScopedPointer filePointer; + std::unique_ptr filePointer; bool opened; if (fd == -1) { - auto tmpFile = new QTemporaryFile (QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + + auto tmpFile = + std::make_unique(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + QLatin1String("/wayland-shm-XXXXXX")); opened = tmpFile->open(); - filePointer.reset(tmpFile); + filePointer = std::move(tmpFile); } else { - auto file = new QFile; + auto file = std::make_unique(); opened = file->open(fd, QIODevice::ReadWrite | QIODevice::Unbuffered, QFile::AutoCloseHandle); - filePointer.reset(file); + filePointer = std::move(file); } // NOTE beginPaint assumes a new buffer be all zeroes, which QFile::resize does. if (!opened || !filePointer->resize(alloc)) {