From 484504ef8349ddc325ce8ea60416b2916a2ae076 Mon Sep 17 00:00:00 2001 From: Stefan Hansson Date: Mon, 20 Oct 2025 10:02:07 +0200 Subject: [PATCH 1/3] conf-tweaks: Remove nonsensical assertion I'm not sure why I added this assertion, but my guess would be that either `from` also used to be a pointer, or I just didn't really think about that it wasn't one when adding that. Either way, it makes no sense since it's perfectly valid for the weigh of a setting to be 0. Asserting that `into` is not 0 makes sense since it is a pointer and this function will crash if `into` is a NULL pointer. Closes https://gitlab.gnome.org/World/Phosh/phosh-mobile-settings/-/issues/88 Fixes b113b068e26ce11cb645b5570d9f00a999cb8de0 Signed-off-by: Stefan Hansson (cherry picked from commit 1e33ee476f377d0f193091ef6ae921c347835be6) Part-of: --- src/conf-tweaks/ms-tweaks-parser.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/conf-tweaks/ms-tweaks-parser.c b/src/conf-tweaks/ms-tweaks-parser.c index e01f02c4..79d02199 100644 --- a/src/conf-tweaks/ms-tweaks-parser.c +++ b/src/conf-tweaks/ms-tweaks-parser.c @@ -421,7 +421,6 @@ static void merge_weights (int *into, const int from) { g_assert (into); - g_assert (from); /* Only overwrite the weight if it wasn't specified. We assume that even if the default was * specified, the original definition didn't care about the weight. */ -- GitLab From 262b73b27fa39550f6d16f3e8784987a090defce Mon Sep 17 00:00:00 2001 From: Stefan Hansson Date: Mon, 20 Oct 2025 10:25:13 +0200 Subject: [PATCH 2/3] tests: Add tests for merge_weights () Signed-off-by: Stefan Hansson (cherry picked from commit ac0bb4a4c68cf8970b3a6c1b082455e6b0033313) Part-of: --- tests/test-tweaks-parser.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test-tweaks-parser.c b/tests/test-tweaks-parser.c index 047d6986..ac054687 100644 --- a/tests/test-tweaks-parser.c +++ b/tests/test-tweaks-parser.c @@ -184,6 +184,32 @@ test_copy_page (void) ms_tweaks_page_free (page); } + +static void +test_merge_weights (void) +{ + int into = 50; + const int from = 0; + + merge_weights (&into, from); + + g_assert_cmpint (into, ==, 0); + g_assert_cmpint (into, ==, from); +} + + +static void +test_merge_weights_no_merge (void) +{ + int into = 25; + const int from = 100; + + merge_weights (&into, from); + + g_assert_cmpint (into, ==, 25); + g_assert_cmpint (into, !=, from); +} + /** * test_parse_nothing: * Ensures that trying to parse a nonexistent path is handled gracefully. @@ -777,6 +803,10 @@ main (int argc, char *argv[]) test_copy_section); g_test_add_func ("/phosh-mobile-settings/test-tweaks-parser-copy-page", test_copy_page); + g_test_add_func ("/phosh-mobile-settings/test-tweaks-parser-merge-weights", + test_merge_weights); + g_test_add_func ("/phosh-mobile-settings/test-tweaks-parser-merge-weights-no-merge", + test_merge_weights_no_merge); PARSER_TEST_ADD ("/phosh-mobile-settings/test-tweaks-parser-parse-nothing", test_parse_nothing); PARSER_TEST_ADD ("/phosh-mobile-settings/test-tweaks-parser-parse-basic", -- GitLab From 08c0e0368dff5fe61b09c00f4a9e381e576fcc5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Wed, 22 Oct 2025 13:06:10 +0200 Subject: [PATCH 3/3] treewide: Document changes and release 0.50.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Guido Günther Part-of: --- NEWS | 7 +++++++ data/mobi.phosh.MobileSettings.metainfo.xml.in | 8 ++++++++ debian/changelog | 9 +++++++++ meson.build | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ffddf065..25e8453f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +phosh-mobile-settings 0.50.1 +---------------------------- +Released October 2025 +* Fix possible crash on startup with conf tweaks +* Contributors: + * Stefan Hansson + phosh-mobile-settings 0.50.0 ---------------------------- Released October 2025 diff --git a/data/mobi.phosh.MobileSettings.metainfo.xml.in b/data/mobi.phosh.MobileSettings.metainfo.xml.in index 2364a1a5..d09312b5 100644 --- a/data/mobi.phosh.MobileSettings.metainfo.xml.in +++ b/data/mobi.phosh.MobileSettings.metainfo.xml.in @@ -52,6 +52,14 @@ + + +
    +
  • Fix possible crash on startup with conf tweaks
  • +
+
+
+
    diff --git a/debian/changelog b/debian/changelog index bb9ab99a..0e29bf4a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +phosh-mobile-settings (0.50.1) experimental; urgency=medium + + [ Stefan Hansson ] + * conf-tweaks: Remove nonsensical assertion. + Closes https://gitlab.gnome.org/World/Phosh/phosh-mobile-settings/-/issues/88 + * tests: Add tests for merge_weights() + + -- Guido Günther Wed, 22 Oct 2025 13:05:57 +0200 + phosh-mobile-settings (0.50.0) experimental; urgency=medium [ Guido Günther ] diff --git a/meson.build b/meson.build index 300e899a..30226a10 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'phosh-mobile-settings', 'c', - version: '0.50.0', + version: '0.50.1', meson_version: '>= 1.7.0', default_options: ['warning_level=2', 'werror=false', 'c_std=gnu11'], ) -- GitLab