Use GTK_IS_ENTRY() to determine if widget is a GtkEntry.

If widget is not a GtkEntry, using GTK_ENTRY() will result in assertion or crash


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2012-07-11 16:49:07 +00:00
parent 85668a34b3
commit d962569aae

View File

@@ -204,9 +204,12 @@ long wxTextEntry::GetLastPosition() const
{ {
// this can't be implemented for arbitrary GtkEditable so only do it for // this can't be implemented for arbitrary GtkEditable so only do it for
// GtkEntries // GtkEntries
GtkEntry * const entry = GTK_ENTRY(GetEditable()); long pos = -1;
GtkEditable* editable = GetEditable();
if (GTK_IS_ENTRY(editable))
pos = gtk_entry_get_text_length(GTK_ENTRY(editable));
return entry ? gtk_entry_get_text_length(entry) : -1; return pos;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------