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 767028 - GtkMenuTrcker could crash in gtk_menu_tracker_model_changed if there are no items
GtkMenuTrcker could crash in gtk_menu_tracker_model_changed if there are no i...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: Marco Trevisan (Treviño)
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-05-30 15:09 UTC by Marco Trevisan (Treviño)
Modified: 2018-04-15 00:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkMenuTracker: don't try to deference *change_point when it's NULL (1.80 KB, patch)
2016-05-30 15:09 UTC, Marco Trevisan (Treviño)
none Details | Review

Description Marco Trevisan (Treviño) 2016-05-30 15:09:25 UTC
This is something that we see quite often in Unity (https://pad.lv/1296674).

For example:

    at /build/gtk+3.0-3sSotQ/gtk+3.0-3.10.8/./gtk/gtkmenutracker.c:339

(where src is https://github.com/GNOME/gtk/blob/gtk-3-10/gtk/gtkmenutracker.c#L339)

(gdb) print section
$2 = (GtkMenuTrackerSection *) 0x7f6be1bba2d0
(gdb) print section->items
$3 = (GSList *) 0x0

I think it's quite sane to avoid deferencing *change_point when it's NULL.
Comment 1 Marco Trevisan (Treviño) 2016-05-30 15:09:30 UTC
Created attachment 328734 [details] [review]
GtkMenuTracker: don't try to deference *change_point when it's NULL
Comment 2 Matthias Clasen 2016-05-30 22:01:16 UTC
First steop here would be a test case that reproduces the problem you are seeing.
Comment 3 Marco Trevisan (Treviño) 2016-05-30 22:23:16 UTC
(In reply to Matthias Clasen from comment #2)
> First steop here would be a test case that reproduces the problem you are
> seeing.

Unfortunately this is quite a random issue, which happens for some years regularly in Ubuntu, but there are no known ways to reproduce this. 

However I believe that a null guard is always something that doesn't harm (while probably I should add some g_critical logs)
Comment 4 Matthias Clasen 2016-05-31 18:07:17 UTC
(In reply to Marco Trevisan (Treviño) from comment #3)
 
> However I believe that a null guard is always something that doesn't harm
> (while probably I should add some g_critical logs)

Adding random NULL guards in places where NULL isn't supposed to go only clouds up the actual underlying issue, though: Why is change_point NULL ? The code in the caller (gtk_menu_tracker_model_changed) doesn't look to me like it expects change_point to ever be NULL.
Comment 5 Marco Trevisan (Treviño) 2016-05-31 18:19:57 UTC
(In reply to Matthias Clasen from comment #4)
> (In reply to Marco Trevisan (Treviño) from comment #3)
>  
> > However I believe that a null guard is always something that doesn't harm
> > (while probably I should add some g_critical logs)
> 
> Adding random NULL guards in places where NULL isn't supposed to go only
> clouds up the actual underlying issue, though: Why is change_point NULL ?

I agree. But unfortunately during this time I've never been able to figure out a proper test case.

For some reason it seems that section->items is null sometimes, thus is *change_point. I'm not that into this codebase to give a deeper explaination, though, so I guess desrt could step in for better guessing.

> The code in the caller (gtk_menu_tracker_model_changed) doesn't look to me
> like it expects change_point to ever be NULL.

No, in fact... That's never protected. BUt I think failing critically is still always better than crashing.
Comment 6 Matthias Clasen 2018-02-10 05:06:11 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 7 Matthias Clasen 2018-04-15 00:26:23 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new