mate-desktop / mate-control-center

Utilities to configure the MATE desktop
https://mate-desktop.org
GNU General Public License v2.0
68 stars 59 forks source link

appearance: Fix compilation warnings replace deprecated functions #736

Closed zhuyaliang closed 1 year ago

zhuyaliang commented 1 year ago

g_pattern_match_string has been deprecated since GLib 2.70

raveit65 commented 1 year ago

I don't know how to test the theme installer (what to use for a theme for this?)

It simply installs a compressed theme which you can download from e.g https://www.gnome-look.org/browse/ Ihmo m-a-p handle .gz files. You can also compress you own theme for testing.

raveit65 commented 1 year ago

The -Wunused-parameter warning flags is only visible at travis-ci debian build. To enable them was a wish of a former Mate developer but it generate a lot of warnings and it is a huge work to fix them all in mate repositories. We disabled it for fedora build to get a readable buildlog. I am really not sure about this warn flag because nobody did care about.

zhuyaliang commented 1 year ago

@raveit65 When I have enough time, I will start fix other project and files unused-parameter warning

raveit65 commented 1 year ago

@mate-desktop/core-team Maybe we should disable the -Wunused-parameter warning flag for debian CI build? It does the same job as adding an unused modifier. https://github.com/mate-desktop/mate-control-center/blob/master/.build.yml#L187C1-L191C7

build_scripts:
  - if [ ${DISTRO_NAME} == "debian" ];then
  -     export CFLAGS+=" -Wsign-compare -Wunused-parameter"
  -     cppcheck --enable=warning,style,performance,portability,information,missingInclude -i"mate-desktop-${MATE_DESKTOP_VERSION}" .
  - fi
raveit65 commented 1 year ago

When I have enough time, I will start fix other project and files unused-parameter warning

@zhuyaliang Not sure if this is really needed. I recall that some people stated this warning flag as really questionable.

raveit65 commented 1 year ago

M-a-p crashes when pressing the OK button during adding a theme. m-a-p_crash Tested with Orchis-Orange.tar.xz from https://www.gnome-look.org/p/1357889 This doesn't happen with mate-control-center-1.27.0. Backtrace:

Thread 1 (Thread 0x7f1ad5599ac0 (LWP 68808)):
#0  g_type_check_instance_is_fundamentally_a (type_instance=0x56137ae5a8a0, fundamental_type=0x50) at ../gobject/gtype.c:4166
        node = <optimized out>
#1  0x00007f1ad684fbf8 in g_object_ref (_object=_object@entry=0x56137ae5a8a0) at ../gobject/gobject.c:3775
        _g_boolean_var_130 = <optimized out>
        object = 0x56137ae5a8a0
        old_val = <optimized out>
        object_already_finalized = <optimized out>
        __func__ = "g_object_ref"
#2  0x00007f1ad6944b74 in g_task_new (source_object=source_object@entry=0x56137ae5a8a0, cancellable=cancellable@entry=0x0, callback=callback@entry=0x0, callback_data=callback_data@entry=0x0) at ../gio/gtask.c:777
        task = 0x56137b378760
        source = <optimized out>
#3  0x000056137991dc17 in theme_cleanup_tmp_dir (tmp_dir=0x56137ae5a8a0 "/home/rave/.themes/.theme-155255412") at /usr/src/debug/mate-control-center-1.27.0-2.fc38.x86_64/capplets/appearance/theme-installer.c:559
        task = <optimized out>
        dir = 0x56137ae1dfc0
        tmp_dir = 0x56137ae5a8a0 "/home/rave/.themes/.theme-155255412"
        ok = <optimized out>
        todelete = <optimized out>
        name = 0x0
        n_themes = <optimized out>
        dialog = <optimized out>
        filetype = <optimized out>
#4  process_local_theme (parent=0x56137a91c740, path=<optimized out>) at /usr/src/debug/mate-control-center-1.27.0-2.fc38.x86_64/capplets/appearance/theme-installer.c:678
        dir = 0x56137ae1dfc0
        tmp_dir = 0x56137ae5a8a0 "/home/rave/.themes/.theme-155255412"
        ok = <optimized out>
        todelete = <optimized out>
        name = 0x0
        n_themes = <optimized out>
        dialog = <optimized out>
        filetype = <optimized out>
#5  0x000056137991dd06 in transfer_done_cb (dialog=<optimized out>, tdata=0x56137b2a5060) at /usr/src/debug/mate-control-center-1.27.0-2.fc38.x86_64/capplets/appearance/theme-installer.c:698
#6  0x00007f1ad68444ea in g_closure_invoke (closure=0x56137b0bcba0, return_value=0x0, n_param_values=1, param_values=0x7ffc1028d0d0, invocation_hint=0x7ffc1028d050) at ../gobject/gclosure.c:832
        marshal = 0x7f1ad68494d0 <g_cclosure_marshal_VOID__VOID>
        marshal_data = 0x0
        in_marshal = 0
        real_closure = 0x56137b0bcb80
        __func__ = "g_closure_invoke"
#7  0x00007f1ad6872e16 in signal_emit_unlocked_R.isra.0 (node=node@entry=0x56137b1ea6e0, detail=detail@entry=0, instance=instance@entry=0x56137b38f6e0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffc1028d0d0) at ../gobject/gsignal.c:3812
        tmp = <optimized out>
        handler = 0x56137b3ec8f0
        accumulator = 0x0
        emission = {next = 0x0, instance = 0x56137b38f6e0, ihint = {signal_id = 546, detail = 0, run_type = (G_SIGNAL_RUN_FIRST | G_SIGNAL_ACCUMULATOR_FIRST_RUN)}, state = EMISSION_RUN, chain_type = 0x4}
        handler_list = 0x56137b3ec8f0
        return_accu = 0x0
        accu = {g_type = 0x0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 546
        max_sequential_handler_number = 22875
        return_value_altered = <optimized out>
#8  0x00007f1ad6863cbd in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffc1028d270) at ../gobject/gsignal.c:3565
        instance_and_params = <optimized out>
        signal_return_type = <optimized out>
        param_values = <optimized out>
        node = <optimized out>
        i = <optimized out>
        n_params = <optimized out>
        __func__ = "g_signal_emit_valist"
#9  0x00007f1ad6863f33 in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3622
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7ffc1028d350, reg_save_area = 0x7ffc1028d290}}
#10 0x000056137991a029 in file_transfer_dialog_done (dialog=<optimized out>) at ../common/file-transfer-dialog.c:400
#11 0x00007f1ad690a7d4 in mainloop_proxy_func (data=data@entry=0x7f1a9003d080) at ../gio/gioscheduler.c:205
        proxy = 0x7f1a9003d080
#12 0x00007f1ad673f4fd in g_idle_dispatch (source=0x7f1a9003f900, callback=0x7f1ad690a7c0 <mainloop_proxy_func>, user_data=0x7f1a9003d080) at ../glib/gmain.c:6163
        idle_source = 0x7f1a9003f900
        again = <optimized out>
#13 0x00007f1ad67434fc in g_main_dispatch (context=0x56137a5f0280) at ../glib/gmain.c:3460
        dispatch = 0x7f1ad673f4d0 <g_idle_dispatch>
        prev_source = 0x0
        begin_time_nsec = 8634680091534
        was_in_call = 0
        user_data = 0x7f1a9003d080
        callback = 0x7f1ad690a7c0 <mainloop_proxy_func>
        cb_funcs = 0x7f1ad682e380 <g_source_callback_funcs>
        cb_data = 0x7f1a9003e480
        need_destroy = <optimized out>
        source = 0x7f1a9003f900
        current = 0x56137a6154a0
        i = 2
#14 g_main_context_dispatch (context=0x56137a5f0280) at ../glib/gmain.c:4200
#15 0x00007f1ad67a16b8 in g_main_context_iterate.isra.0 (context=0x56137a5f0280, block=1, dispatch=1, self=<optimized out>) at ../glib/gmain.c:4276
        max_priority = 0
        timeout = 0
        some_ready = 1
        nfds = 3
        allocated_nfds = <optimized out>
        fds = <optimized out>
        begin_time_nsec = 8634679704128
#16 0x00007f1ad6742aff in g_main_loop_run (loop=0x56137a5b0120) at ../glib/gmain.c:4479
        __func__ = "g_main_loop_run"
#17 0x00007f1ad6e06975 in gtk_main () at ../gtk/gtkmain.c:1329
        loop = 0x56137a5b0120
#18 0x000056137990dd41 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/mate-control-center-1.27.0-2.fc38.x86_64/capplets/appearance/appearance-main.c:247
        data = 0x56137a742330
        w = <optimized out>
        nb = <optimized out>
        nb_custom_theme = 0x56137a8d5ed0
        context = <optimized out>
        install_filename = 0x0
        start_page = 0x0
        wallpaper_files = 0x0
        option_context = 0x56137a5aff90
        option_entries = {{long_name = 0x561379923e37 "install-theme", short_name = 105 'i', flags = 2, arg = G_OPTION_ARG_FILENAME, arg_data = 0x7ffc1028d588, description = 0x561379924808 "Specify the filename of a theme to install", arg_description = 0x561379923542 "filename"}, {long_name = 0x561379923e45 "show-page", short_name = 112 'p', flags = 2, arg = G_OPTION_ARG_STRING, arg_data = 0x7ffc1028d580, description = 0x561379924838 "Specify the name of the page to show (theme|background|fonts|interface)", arg_description = 0x561379923e4a "page"}, {long_name = 0x561379925319 "", short_name = 0 '\000', flags = 2, arg = G_OPTION_ARG_FILENAME_ARRAY, arg_data = 0x7ffc1028d578, description = 0x0, arg_description = 0x561379923e4f "[WALLPAPER...]"}, {long_name = 0x0, short_name = 0 '\000', flags = 0, arg = G_OPTION_ARG_NONE, arg_data = 0x0, description = 0x0, arg_description = 0x0}}

The theme will be correct installed to

[rave@mother .themes]$ ls ~/.themes
Orchis-Orange          Orchis-Orange-Dark          Orchis-Orange-Light
Orchis-Orange-Compact  Orchis-Orange-Dark-Compact  Orchis-Orange-Light-Compact

There are also glib runtime warnings but they are unrelated because they exists already in master.

zhuyaliang commented 1 year ago

@raveit65 Thank you for your test. The problem has been fixed

raveit65 commented 1 year ago

Confirmed that the crash is fixed and adding a theme works properly.

raveit65 commented 1 year ago

The media-button is still there with some slideshows. m-a-p_media_button But the button doesn't work, not an issue here because it is broken in master since years. I think the function was lost during gtk-2-0/gtk-3.0 transition.

raveit65 commented 1 year ago

I guess this is ready to go now?