UI: Use std::shared_ptr instead of QSharedPointer

Also use std::weak_ptr instead of QWeakPointer as needed.

Qt has been porting QSharedPointer and QWeakPointer to std::shared_ptr
and std::weak_ptr respectively. QSharedPointer is apparently 2x slower
than std::shared_ptr.

References:
 * https://bugreports.qt.io/browse/QTBUG-109570
 * https://codereview.qt-project.org/c/qt/qtbase/+/359678
 * https://codereview.qt-project.org/c/qt/qtgrpc/+/447780
 * https://codereview.qt-project.org/c/qt/qtbase/+/450134
 * https://codereview.qt-project.org/c/qt/qttools/+/450776
 * https://codereview.qt-project.org/c/qt/qttools/+/450777
 * https://codereview.qt-project.org/q/QSharedPointer
This commit is contained in:
Ryan Foster
2023-10-03 18:13:56 -04:00
parent 3d05d681b7
commit 02478d4939
5 changed files with 12 additions and 13 deletions

View File

@@ -10487,7 +10487,7 @@ void OBSBasic::AddDockWidget(QDockWidget *dock, Qt::DockWidgetArea area,
#endif
extraDockNames.push_back(dock->objectName());
extraDocks.push_back(QSharedPointer<QDockWidget>(dock));
extraDocks.push_back(std::shared_ptr<QDockWidget>(dock));
}
void OBSBasic::RemoveDockWidget(const QString &name)
@@ -10495,7 +10495,7 @@ void OBSBasic::RemoveDockWidget(const QString &name)
if (extraDockNames.contains(name)) {
int idx = extraDockNames.indexOf(name);
extraDockNames.removeAt(idx);
extraDocks[idx].clear();
extraDocks[idx].reset();
extraDocks.removeAt(idx);
} else if (extraCustomDockNames.contains(name)) {
int idx = extraCustomDockNames.indexOf(name);