After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 760030 - Crash in TreeView::get_tooltip_context_path
Crash in TreeView::get_tooltip_context_path
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: TreeView
3.18.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2015-12-31 17:19 UTC by Philipp Lenk
Modified: 2016-01-01 19:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A simple, ugly test demonstrating the bug (1.48 KB, text/x-c++src)
2015-12-31 17:19 UTC, Philipp Lenk
  Details
patch (1.00 KB, patch)
2015-12-31 21:36 UTC, Philipp Lenk
committed Details | Review

Description Philipp Lenk 2015-12-31 17:19:05 UTC
Created attachment 318080 [details]
A simple, ugly test demonstrating the bug

TreeView::get_tooltip_context_path causes a crash due to a double delete if gtk_tree_view_get_tooltip_context returns false(i.e. when hovering over the TreeView, but not over a row). This is the same issue that was fixed in IconView a while ago:

https://git.gnome.org/browse/gtkmm/commit/gtk/src/iconview.ccg?id=fdbdce42f4a4405e9709f5a206c9df96c2adb6e4

A simplistic, minimal, ugly, quickly hacked together testcase is attached. It just creates a TreeView with a TreeStore showing a few numbers, sets has_tooltip and connects to signal_query_tooltip. The callback only calls get_tooltip_context_path and returns false, which causes the aforementioned crash. Replacing it with a call to get_tooltip_context_iter and constructing a path does not cause problems.

I compiled the testcase with the following command: 

g++ test_tree_view_get_tooltip_context_path.cpp -o test `pkg-config gtkmm-3.0 --cflags --libs` -std=c++11 -Wall -pedantic -Werror

on Arch Linux with gtkmm3 3.18.0-2.
Comment 1 Philipp Lenk 2015-12-31 21:36:12 UTC
Created attachment 318103 [details] [review]
patch
Comment 2 Kjell Ahlstedt 2016-01-01 16:16:26 UTC
Thanks. I've pushed your patch.

Your test case is good enough.
The only thing that's not perfect is that you did not create the patch with
  git add gtk/src/treeview.ccg
  git commit
  git format-patch origin
or a similar sequence of git commands.
Comment 3 Philipp Lenk 2016-01-01 16:35:13 UTC
Thanks ;-)
I simply followed the directions found here: http://www.gtkmm.org/en/bugs.html#NewBugs and therefore used the command 

git diff -u > my_fix.patch 

If this is not the prefered way, maybe the page could/should be updated?
Comment 4 Kjell Ahlstedt 2016-01-01 19:19:58 UTC
It's true, like is said in www.gtkmm.org, that git diff is the simplest way to
create a patch, if you are unfamiliar with Git. We could perhaps add an
alternative for those who want to make an even better patch.

www.gtkmm.org is not updated as often as it should be. It contains several
obsolete details. For example it's said that you should edit ChangeLog when
you create a patch. That's not true any more.