[gtkmm/wip/dboles/Builder-test-cleanups: 2/3] tests/builder: Default-init members at declaration
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/wip/dboles/Builder-test-cleanups: 2/3] tests/builder: Default-init members at declaration
- Date: Sun, 24 Nov 2019 14:06:26 +0000 (UTC)
commit 87acd6b475d18e6794b5e544c85365e6c0cc99e9
Author: Daniel Boles <dboles src gmail com>
Date: Sun Nov 24 14:02:30 2019 +0000
tests/builder: Default-init members at declaration
as that is safer than having to remember to default-construct pointers
in every constructor overload—& getting undefined behaviour if we don’t.
tests/builder/main.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/builder/main.cc b/tests/builder/main.cc
index 093c2edc..df59dbba 100644
--- a/tests/builder/main.cc
+++ b/tests/builder/main.cc
@@ -107,7 +107,7 @@ class MainWindow : public Gtk::Window
{
public:
MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refBuilder)
- : Gtk::Window(cobject), m_pDerivedButton(nullptr), m_pStandardButton(nullptr)
+ : Gtk::Window(cobject)
{
std::cout << "MainWindow::ctor" << std::endl;
@@ -129,8 +129,8 @@ public:
const Gtk::Button* get_standard_button() const { return m_pStandardButton; }
private:
- DerivedButton* m_pDerivedButton;
- Gtk::Button* m_pStandardButton;
+ DerivedButton* m_pDerivedButton = nullptr;
+ Gtk::Button* m_pStandardButton = nullptr;
};
} // end of anonymous namespace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]