From 8cdd20667fc941c7d54bee87c667586555fcc578 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Jul 2019 21:41:27 +0200 Subject: [PATCH] Initialize wxTopLevelWindow::DecorSize in wxGTK Add default ctor for this struct as it was too easy to forget to initialize it otherwise, ending up with bogus values in it, as it happened with wxTLWGeometry::m_decorSize, which resulted in a failure in wxPersistTLW unit test and, probably, real code too. --- include/wx/gtk/toplevel.h | 8 ++++++++ src/gtk/minifram.cpp | 1 - src/gtk/toplevel.cpp | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index a95358d88e..602a232aba 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -112,6 +112,14 @@ public: // size of WM decorations struct DecorSize { + DecorSize() + { + left = + right = + top = + bottom = 0; + } + int left, right, top, bottom; }; DecorSize m_decorSize; diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index 923b8f4b89..2cf63de9c0 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -307,7 +307,6 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title if (style & wxRESIZE_BORDER) m_gdkFunc |= GDK_FUNC_RESIZE; gtk_window_set_default_size(GTK_WINDOW(m_widget), m_width, m_height); - memset(&m_decorSize, 0, sizeof(m_decorSize)); m_deferShow = false; if (m_parent && (GTK_IS_WINDOW(m_parent->m_widget))) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 57a457a418..c21d0e427c 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -565,7 +565,6 @@ void wxTopLevelWindowGTK::Init() m_updateDecorSize = true; m_netFrameExtentsTimerId = 0; m_incWidth = m_incHeight = 0; - memset(&m_decorSize, 0, sizeof(m_decorSize)); m_urgency_hint = -2; }