]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't crash in wxControl::GetLabel when getting the label
authorMattia Barbon <mbarbon@cpan.org>
Thu, 28 Aug 2003 20:39:37 +0000 (20:39 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Thu, 28 Aug 2003 20:39:37 +0000 (20:39 +0000)
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
src/motif/frame.cpp
src/motif/window.cpp

index 6b5b4c916288a0fb68cab47cf01ea4109a57d10a..e6d45853c9b0f832f4b3456cd7fb0a30aea52207 100644 (file)
@@ -99,7 +99,7 @@ wxString wxControl::GetLabel() const
     if (!widget)
         return wxEmptyString;
 
-    XmString text;
+    XmString text = NULL;
     XtVaGetValues (widget,
         XmNlabelString, &text,
         NULL);
index 061c5a675b81e9176ba49c60606b83105575e629..6213bc498c3cc31e68a54b23a42ef5412a5dd9d8 100644 (file)
@@ -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
index fcb9aa4b493155713407d98e4f4684dfd66eb608..6b87a729e162e5cdc41294fffd0cd392825e6994 100644 (file)
@@ -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);
         }