Replace QScopedPointer with std::unique_ptr

As the warning asked.

qwaylandshellintegrationfactory.cpp:67:28: warning: ‘T* QScopedPointer<T, Cleanup>::take() [with T = QtWaylandClient::QWaylandShellIntegration; Cleanup = QScopedPointerDeleter<QtWaylandClient::QWaylandShellIntegration>]’ is deprecated: Use std::unique_ptr instead, and call release(). [-Wdeprecated-declarations]

As a drive-by, change *foo.get() to *foo.

Pick-to: 6.3 6.2
Change-Id: I7fb65b80b7844c8d8f26fffd16e97fe161d6a67a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-04-26 09:44:25 -07:00 committed by Marc Mutz
parent aedb14b232
commit 38d6f09d30
3 changed files with 5 additions and 5 deletions

View File

@ -389,7 +389,7 @@ QWaylandDisplay::~QWaylandDisplay(void)
qDeleteAll(mWaitingScreens);
#if QT_CONFIG(wayland_datadevice)
delete mDndSelectionHandler.take();
mDndSelectionHandler.reset();
#endif
#if QT_CONFIG(cursor)
mCursorThemes.clear();

View File

@ -165,7 +165,7 @@ public:
QWaylandInputDevice *defaultInputDevice() const;
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
#if QT_CONFIG(wayland_datadevice)
QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.data(); }
QWaylandDataDeviceManager *dndSelectionHandler() const { return mDndSelectionHandler.get(); }
#endif
#if QT_CONFIG(wayland_client_primary_selection)
QWaylandPrimarySelectionDeviceManagerV1 *primarySelectionManager() const { return mPrimarySelectionManager.data(); }
@ -249,7 +249,7 @@ private:
};
struct wl_display *mDisplay = nullptr;
QScopedPointer<EventThread> m_eventThread;
std::unique_ptr<EventThread> m_eventThread;
wl_event_queue *m_frameEventQueue = nullptr;
QScopedPointer<EventThread> m_frameEventQueueThread;
QtWayland::wl_compositor mCompositor;

View File

@ -58,13 +58,13 @@ QStringList QWaylandShellIntegrationFactory::keys()
QWaylandShellIntegration *QWaylandShellIntegrationFactory::create(const QString &name, QWaylandDisplay *display, const QStringList &args)
{
QScopedPointer<QWaylandShellIntegration> integration;
std::unique_ptr<QWaylandShellIntegration> integration;
integration.reset(qLoadPlugin<QWaylandShellIntegration, QWaylandShellIntegrationPlugin>(loader(), name, args));
if (integration && !integration->initialize(display))
return nullptr;
return integration.take();
return integration.release();
}
}