UI: Use QScopedPointer (not QPointer) where applicable

Contrary to what the name would have you believe, QPointer<> is not used
to delete a pointer when it leaves its specific scope.  Instead, it's
used to check to see if the pointer is still valid.  For most
QWidget-based objects, this is actually fine because QWidgets that are
assigned to layouts or other widgets will automatically be destroyed --
however, for non-widget objects, this can cause a memory leak.

This patch replaces QPointer with QScopedPointer where applicable to
prevent memory leaks.

Closes obsproject/obs-studio#1367
This commit is contained in:
jp9000
2018-07-31 21:14:52 -07:00
parent a5d740373c
commit b6665f9cc0
4 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -750,7 +750,7 @@ void OBSBasic::CreateProgramOptions()
programOptions->setLayout(layout);
auto onAdd = [this] () {
QPointer<QMenu> menu = CreateTransitionMenu(this, nullptr);
QScopedPointer<QMenu> menu(CreateTransitionMenu(this, nullptr));
menu->exec(QCursor::pos());
};