gplugin/gplugin

Fix a leak in settings list

14 months ago, Elliott Sales de Andrade
2695cbb5e004
Fix a leak in settings list

Fixes a leak for plugins that have settings:
```
48 (32 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 12,560 of 29,780
at 0x4A231EF: g_type_create_instance (gtype.c:1909)
by 0x4A08C1F: g_object_new_internal (gobject.c:2228)
by 0x4A0A247: g_object_new_with_properties (gobject.c:2391)
by 0x4A0AFF0: g_object_new (gobject.c:2037)
by 0x4C64DA7: gtk_size_group_new (gtksizegroup.c:300)
by 0x487356A: gplugin_gtk_plugin_settings_list_refresh (gplugin-gtk-plugin-settings-list.c:492)
by 0x4873CBA: gplugin_gtk_plugin_settings_list_set_settings (gplugin-gtk-plugin-settings-list.c:662)
by 0x4870DEE: gplugin_gtk_plugin_page_update_settings_list (gplugin-gtk-plugin-page.c:98)
by 0x48717DD: gplugin_gtk_plugin_page_set_plugin (gplugin-gtk-plugin-page.c:394)
by 0x48750EF: gplugin_gtk_view_show_plugin (gplugin-gtk-view.c:567)
by 0x4873FD0: gplugin_gtk_view_row_activated (gplugin-gtk-view.c:82)
by 0x49F8A64: g_cclosure_marshal_VOID__OBJECTv (gmarshal.c:1910)
```

Testing Done:
Opened viewer in valgrind, went to settings plugin's info, and leak was no longer there.

Reviewed at https://reviews.imfreedom.org/r/2305/
###############################################################################
# Project Info
###############################################################################
project('gplugin', 'c',
license : 'LGPL-2.0-or-later',
version : '0.40.1-dev',
meson_version : '>=0.61.0',
default_options : ['c_std=c17', 'warning_level=2'])
parts = meson.project_version().split('-')
if parts.length() > 1
extra = parts[1]
else
extra = ''
endif
parts = parts[0].split('.')
GPLUGIN_MAJOR_VERSION = parts[0]
version_conf = configuration_data()
version_conf.set('GPLUGIN_MAJOR_VERSION', GPLUGIN_MAJOR_VERSION)
version_conf.set('GPLUGIN_MINOR_VERSION', parts[1])
version_conf.set('GPLUGIN_MICRO_VERSION', parts[2])
version_conf.set('GPLUGIN_EXTRA_VERSION', extra)
version_conf.set('GPLUGIN_VERSION', meson.project_version())
###############################################################################
# Dependencies
###############################################################################
gnome = import('gnome')
pkgconfig = import('pkgconfig')
if get_option('help2man')
help2man = find_program('help2man')
endif
GLIB = dependency('glib-2.0', version : '>=2.70.0')
GOBJECT = dependency('gobject-2.0')
# we separate gmodule out so our test aren't linked to it
GMODULE = dependency('gmodule-2.0')
add_project_arguments(
'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70',
'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_70',
language : 'c',
)
###############################################################################
# devenv
#
# This sets up the meson devenv stuff. See
# https://mesonbuild.com/Commands.html#devenv for more information.
###############################################################################
devenv = environment()
config_home = get_option('devenv-config-dir')
if config_home == ''
config_home = meson.project_build_root() / 'config'
endif
devenv.set('XDG_CONFIG_HOME', config_home)
meson.add_devenv(devenv)
###############################################################################
# NLS
###############################################################################
GETTEXT_PACKAGE = 'gplugin'
LOCALE_DIR = get_option('prefix') / get_option('localedir')
add_project_arguments(f'-DLOCALEDIR="@LOCALE_DIR@"', language : 'c')
add_project_arguments(f'-DGETTEXT_PACKAGE="@GETTEXT_PACKAGE@"', language : 'c')
if get_option('nls')
i18n = import('i18n')
endif
###############################################################################
# Build Info
###############################################################################
compiler = meson.get_compiler('c')
add_project_arguments(
'-DPREFIX="@0@"'.format(get_option('prefix')),
'-DLIBDIR="@0@"'.format(get_option('libdir')),
'-DGPLUGIN_WEBSITE="https://keep.imfreedom.org/gplugin/gplugin"',
language : 'c'
)
if compiler.has_argument('-Wformat')
add_project_arguments('-Wformat', language : 'c')
if compiler.has_multi_arguments(['-Wformat', '-Werror=format-security'])
add_project_arguments('-Werror=format-security', language : 'c')
endif
endif
toplevel_inc = include_directories('.')
###############################################################################
# Documentation
###############################################################################
if get_option('doc') and not get_option('introspection')
error('Documentation requires GObject Introspection.')
endif
gidocgen_dep = dependency(
'gi-docgen', version: '>= 2021.1',
fallback: ['gi-docgen', 'dummy_dep'],
required: get_option('doc')
)
gidocgen = find_program('gi-docgen', required : get_option('doc'))
docs_dir = get_option('prefix') / get_option('datadir') / 'doc'
doc_targets = []
###############################################################################
# Subdirectories
###############################################################################
subdir('gplugin')
subdir('gplugin-gtk4')
subdir('gplugin-gtk4-viewer', if_found: GTK4)
subdir('gplugin-query')
subdir('po')
subdir('lua')
subdir('python3')
subdir('vala')
if get_option('doc')
alias_target('doc', doc_targets)
endif
###############################################################################
# Install stuff
###############################################################################
# documentation
install_data('ChangeLog', 'INSTALL.md', 'README.md', 'HACKING.md',
install_dir : get_option('datadir') / 'doc' / 'gplugin')
summary({
'api reference' : get_option('doc'),
'GTK4 widgets' : GTK4,
'man pages' : get_option('help2man'),
}, bool_yn : true, section : 'Miscellaneous')
summary({
'introspection' : get_option('introspection'),
'vapi' : get_option('vapi'),
}, bool_yn : true, section : 'Bindings')