Merge lp://staging/~3v1n0/bamf/mime-types-fix-crash-1058260 into lp://staging/bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Michal Hruby
Approved revision: 491
Merged at revision: 485
Proposed branch: lp://staging/~3v1n0/bamf/mime-types-fix-crash-1058260
Merge into: lp://staging/bamf/0.4
Diff against target: 341 lines (+97/-61)
4 files modified
lib/libbamf/bamf-application.c (+2/-4)
src/bamf-application.c (+42/-57)
tests/bamfdaemon/data/mime-types.desktop (+10/-0)
tests/bamfdaemon/test-application.c (+43/-0)
To merge this branch: bzr merge lp://staging/~3v1n0/bamf/mime-types-fix-crash-1058260
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+127225@code.staging.launchpad.net

Commit message

Daemon, BamfApplication: fix a crash on getting the supported mimes

Also remove the unneeded mimes_initialized, just use the pointer value and add tests.

Description of the change

Fix the function bamf_application_default_get_supported_mime_types that was leading to a crash in default implementation.

Tests added.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

66 + if (!new_mimes)
67 {
68 gchar *empty[] = {NULL};
69 -
70 - mimes = g_strdupv (empty);
71 + mimes = empty;
72 }

Ouch, looks pretty dangerous, you're taking address of a temporary that's not valid outside of that block.

181 + for (it = mimes; *it; it++)
182 + {
183 + g_variant_builder_add (&b, "s", *it);
184 + }

Why so complicated? How about g_variant_new_strv()? (or perhaps `g_variant_new("(@as)", g_variant_new_strv(...));`)

review: Needs Fixing
487. By Marco Trevisan (Treviño)

Daemon, tests: add one more mime types test (for invalid mimes)

488. By Marco Trevisan (Treviño)

Daemon, BamfApplication: be safer on managing empty mimes

489. By Marco Trevisan (Treviño)

BamfApplication: use g_variant_new_strv for building string arrays

490. By Marco Trevisan (Treviño)

Tests, Daemon: application code cleanup

491. By Marco Trevisan (Treviño)

Daemon, BamfApplication: no need to have an empty array... Just pass null to g_variant_new_strv

Revision history for this message
Michal Hruby (mhr3) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches