X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f4322df68b099e5e983acc0a3dad4ad5841b57b5..c5c01214025f3682c2eaf79d5476c8c82f9c920b:/src/gtk/stattext.cpp diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 6fe31c64c6..67eec8eef5 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -178,8 +178,11 @@ wxSize wxStaticText::DoGetBestSize() const // Do not return any arbitrary default value... wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") ); - // GetBestSize is supposed to return unwrapped size - gtk_label_set_line_wrap( GTK_LABEL(m_widget), FALSE ); + // GetBestSize is supposed to return unwrapped size but calling + // gtk_label_set_line_wrap() from here is a bad idea as it queues another + // size request by calling gtk_widget_queue_resize() and we end up in + // infinite loop sometimes (notably when the control is in a toolbar) + GTK_LABEL(m_widget)->wrap = FALSE; GtkRequisition req; req.width = -1; @@ -187,7 +190,7 @@ wxSize wxStaticText::DoGetBestSize() const (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (m_widget, &req ); - gtk_label_set_line_wrap( GTK_LABEL(m_widget), TRUE ); + GTK_LABEL(m_widget)->wrap = TRUE; // restore old value // Adding 1 to width to workaround GTK sometimes wrapping the text needlessly return wxSize (req.width+1, req.height);