mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-19 09:41:32 +08:00
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:
@@ -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());
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user