]> git.saurik.com Git - wxWidgets.git/commitdiff
Minor fixes to wxDataViewCtrl::HitTest() in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Jan 2012 00:05:03 +0000 (00:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Jan 2012 00:05:03 +0000 (00:05 +0000)
Initialize the return parameters with invalid values and use const_cast<>.

See #12582.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/dataview.cpp

index ffbea2a9a16063d6599f27f67c11424398867aa6..5e777e02506237fa9d06ef206ead8fd8f1c18951 100644 (file)
@@ -5030,7 +5030,8 @@ void wxDataViewCtrl::HitTest(const wxPoint& point,
     // gtk_tree_view_get_path_at_pos() is the wrong function. It doesn't mind the header but returns column.
     // See http://mail.gnome.org/archives/gtkmm-list/2005-January/msg00080.html
     // So we have to use both of them.
-    // Friedrich Haase 2010-9-20
+    item = wxDataViewItem(0);
+    column = NULL;
     wxGtkTreePath path, pathScratch;
     GtkTreeViewColumn* GtkColumn = NULL;
     GtkTreeViewDropPosition pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER;
@@ -5038,8 +5039,8 @@ void wxDataViewCtrl::HitTest(const wxPoint& point,
     gint cell_y = 0;
     
     // cannot directly call GtkGetTreeView(), HitTest is const and so is this pointer
-    wxDataViewCtrl* ctrl = (wxDataViewCtrl*)this; // ugly workaround, ctrl is NOT const
-    GtkTreeView* treeView = GTK_TREE_VIEW(ctrl->GtkGetTreeView());
+    wxDataViewCtrl* self = const_cast<wxDataViewCtrl *>(this); // ugly workaround, self is NOT const
+    GtkTreeView* treeView = GTK_TREE_VIEW(self->GtkGetTreeView());
     
     // is there possibly a better suited function to get the column?
     gtk_tree_view_get_path_at_pos(                // and this is the wrong call but it delivers the column