From a2ff49eeeb2760727ada90eba49f6eb901725f9d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 10 Nov 2019 00:35:07 +0100 Subject: [PATCH] Initialize wxWindowDCImpl::m_window for hidden windows too Ensure that we set m_window in case of early return from wxWindowDCImpl ctor, so that using e.g. wxDC::GetSize() works for wxClientDC created for windows that hadn't been realized yet. It might be possible to avoid this early return completely as the comment explaining why we're doing it seems to be out of date: our SetBackground() doesn't call wxWindow::SetBackground() (and it would be exceedingly strange if it did), but for now just the bug without changing anything else. Closes #18569. --- src/gtk/dcclient.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 66f0e14f65..d879b2f9e0 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -314,6 +314,8 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) : // Don't report problems as per MSW. m_ok = true; + m_window = window; + return; }