Merge lp:~donadigo/wingpanel-indicator-notifications/fix-g-str-hash-crash into lp:~wingpanel-devs/wingpanel-indicator-notifications/wingpanel-indicator-notifications

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Felipe Escoto
Approved revision: 123
Merged at revision: 124
Proposed branch: lp:~donadigo/wingpanel-indicator-notifications/fix-g-str-hash-crash
Merge into: lp:~wingpanel-devs/wingpanel-indicator-notifications/wingpanel-indicator-notifications
Diff against target: 15 lines (+5/-0)
1 file modified
src/Widgets/NotificationsList.vala (+5/-0)
To merge this branch: bzr merge lp:~donadigo/wingpanel-indicator-notifications/fix-g-str-hash-crash
Reviewer Review Type Date Requested Status
Felipe Escoto Approve
Review via email: mp+311348@code.launchpad.net

Commit message

* Fix g_str_hash crashes.

Description of the change

Fixes bug #1641270: "latest update broke wingpanel".

This will check if the notification has a valid app info with not it's ID which will prevent from g_str_hash segfaults in some cases.

This probably should be done differently and better in the NotificationsMonitor, but for now this simple check will do.

To post a comment you must log in.
Revision history for this message
Felipe Escoto (philip.scott) wrote :

It looks like a sane fix, but is there a way to trigger the crash without the patch? :)

Revision history for this message
Adam Bieńkowski (donadigo) wrote :

philip.scott: I didn't really test it, but I did some tests with AppInfo class, and basically get_id () can return null and in my tests, appending an index to the hashtable made it crash because the string is null and HashTable cannot hash it.

Revision history for this message
Felipe Escoto (philip.scott) wrote :

Looks like a sane check to me!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/NotificationsList.vala'
2--- src/Widgets/NotificationsList.vala 2016-07-21 12:52:41 +0000
3+++ src/Widgets/NotificationsList.vala 2016-11-20 13:34:19 +0000
4@@ -106,6 +106,11 @@
5 }
6
7 private AppEntry? add_entry_internal (NotificationEntry entry) {
8+ if (entry.notification.app_info == null ||
9+ entry.notification.app_info.get_id () == null) {
10+ return null;
11+ }
12+
13 AppEntry? app_entry = null;
14 bool add = !(entry.notification.desktop_id in construct_desktop_id_list ());
15 if (add) {

Subscribers

People subscribed via source and target branches

to all changes: