1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

Ladybird/Qt: Do not "share" ownership of Qt objects

When a QObject subclass (widgets, etc.) are provided a parent, then
ownership of that object is passed to the parent. Similarly, objects
added to a QLayout are owned by the layout.

Thus, do not store these objects in an OwnPtr.
This commit is contained in:
Timothy Flynn 2023-12-04 09:39:22 -05:00 committed by Andrew Kaster
parent a21998003c
commit 4653733a0d
9 changed files with 103 additions and 92 deletions

View file

@ -5,7 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/OwnPtr.h>
#include <QCheckBox>
#include <QDialog>
#include <QFormLayout>
@ -19,6 +18,7 @@ namespace Ladybird {
class SettingsDialog : public QDialog {
Q_OBJECT
public:
explicit SettingsDialog(QMainWindow* window);
@ -27,11 +27,11 @@ private:
QFormLayout* m_layout;
QMainWindow* m_window { nullptr };
OwnPtr<QLineEdit> m_new_tab_page;
OwnPtr<QCheckBox> m_enable_search;
OwnPtr<QPushButton> m_search_engine_dropdown;
OwnPtr<QCheckBox> m_enable_autocomplete;
OwnPtr<QPushButton> m_autocomplete_engine_dropdown;
QLineEdit* m_new_tab_page { nullptr };
QCheckBox* m_enable_search { nullptr };
QPushButton* m_search_engine_dropdown { nullptr };
QCheckBox* m_enable_autocomplete { nullptr };
QPushButton* m_autocomplete_engine_dropdown { nullptr };
};
}