From 887935485423bba2e7eb2b63e933b055af3670da Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Thu, 28 Aug 2003 20:39:37 +0000 Subject: [PATCH] Don't crash in wxControl::GetLabel when getting the label fails (perhaps because the widget is not realized?). Correct wxRTTI information for wxFrame: it derives from wxTopLevelWindow, not wxWindow. Don't try setting Widget size to 0, because it will fail: set it to 1 instead which is exactly as sensible, but does not crash. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/motif/control.cpp | 2 +- src/motif/frame.cpp | 2 +- src/motif/window.cpp | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/motif/control.cpp b/src/motif/control.cpp index 6b5b4c9162..e6d45853c9 100644 --- a/src/motif/control.cpp +++ b/src/motif/control.cpp @@ -99,7 +99,7 @@ wxString wxControl::GetLabel() const if (!widget) return wxEmptyString; - XmString text; + XmString text = NULL; XtVaGetValues (widget, XmNlabelString, &text, NULL); diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 061c5a675b..6213bc498c 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -97,7 +97,7 @@ BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) +IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow) // ============================================================================ // implementation diff --git a/src/motif/window.cpp b/src/motif/window.cpp index fcb9aa4b49..6b87a729e1 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1411,6 +1411,7 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h, w -= 2 * (thick + margin); } + if( w < 1 ) w = 1; XtVaSetValues ((Widget) m_scrolledWindow, XmNwidth, w, NULL); } @@ -1427,6 +1428,7 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h, h -= 2 * (thick + margin); } + if( h < 1 ) h = 1; XtVaSetValues ((Widget) m_scrolledWindow, XmNheight, h, NULL); } -- 2.45.2