[Lazarus] Tools->Options segfaults with ancient gtk (GtkTreeView problem)
Luca Olivetti
luca at wetron.es
Wed Dec 7 11:28:09 CET 2016
El 05/12/16 a les 22:26, Luca Olivetti via Lazarus ha escrit:
> El 05/12/16 a les 17:39, zeljko ha escrit:
>>>
>>>
>>> I changed the call to look like the one for gtk >= 2.14 (i.e, Path
>>> instead of nil) and now I can open the options dialog.
>>> I really don't know gtk2, but maybe the differentiation is needed for an
>>> earlier version of gtk and not 2.14?
>>
>> Maybe < 2.12 should be there
>
> I wouldn't know, as I said I know nothing about gtk, but the available
> documentation doesn't mention if and when the api was changed:
>
> https://developer.gnome.org/gtk2/stable/GtkTreeView.html#gtk-tree-view-set-cursor
>
I checked gtktreeview.c starting from gtk 2.0
https://git.gnome.org/browse/gtk+/tree/gtk/gtktreeview.c?h=gtk-2-0
until gtk 2.24
https://git.gnome.org/browse/gtk+/tree/gtk/gtktreeview.c?h=gtk-2-0
and the implementation of gtk_tree_view_set_cell basically didn't change
(apart form the introduction of gtk_tree_view_set_cursor_on_cell in gtk
2.2).
At the beginning of the function there is
g_return_if_fail (path != NULL);
so I guess path should never be null and the LCL implementation works
just because nobody else is using an older gtk.
Maybe the function could be simplified to
lisFocused:
begin
//gtk2 iter has no focus??
Path := gtk_tree_path_new_from_string(PChar(IntToStr(AIndex)));
if GTK_IS_TREE_VIEW(MainView) then
gtk_tree_view_set_cursor(PGtkTreeView(MainView), Path, nil,
False)
else
if GTK_IS_ICON_VIEW(MainView) then
gtk_icon_view_set_cursor(PGtkIconView(MainView), Path, nil,
False);
gtk_tree_path_free(Path);
end;
of course I may be guessing wrong.
Should I file a bug report?
Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007
More information about the Lazarus
mailing list