Enhancement: Fixes #308, Build - enable asan

This commit is contained in:
Rory Fewell
2024-06-05 06:46:08 +01:00
parent afb3922342
commit da7a18c76b
32 changed files with 960 additions and 357 deletions

View File

@@ -189,6 +189,8 @@ static gboolean parse_file_in_cmdline(
g_propagate_error(out_error, error);
}
g_clear_error(&error);
WINTC_SAFE_REF_SET(out_cmdline, g_strdup(cmdline));
return FALSE;

View File

@@ -52,6 +52,8 @@ gchar* wintc_query_mime_for_file(
return cmd_output;
}
g_free(cmd_output);
// Handle errors
//
if (error != NULL)

View File

@@ -224,6 +224,8 @@ gboolean wintc_registry_get_key_value(
g_critical("registry: unknown type %d", value_type);
break;
}
g_variant_unref(inner);
}
g_variant_unref(value_variant);
@@ -430,4 +432,6 @@ static void on_reg_key_value_changed(
inner,
cb_data->user_data
);
g_variant_unref(inner);
}

View File

@@ -119,7 +119,7 @@ GSList* wintc_sh_cpl_applet_get_all(void)
success = TRUE;
}
g_slist_free(entries);
g_slist_free_full(entries, g_free);
g_key_file_free(key_file);
return cpls;
@@ -148,4 +148,5 @@ void wintc_sh_cpl_applet_free(
g_free(applet->comment);
g_free(applet->exec);
g_free(applet->icon_name);
g_free(applet);
}

View File

@@ -120,6 +120,11 @@ extern WinTCWndMgmtWindow* (*wintc_wndmgmt_screen_get_active_window) (
*/
extern WinTCWndMgmtScreen* (*wintc_wndmgmt_screen_get_default) (void);
/**
* Shuts down window management functionality, releasing all resources.
*/
extern void (*wintc_wndmgmt_shutdown) (void);
/**
* Retrieves the icon for the specified window.
*

View File

@@ -30,6 +30,8 @@ WinTCWndMgmtWindow* (*wintc_wndmgmt_screen_get_active_window) (
) = NULL;
WinTCWndMgmtScreen* (*wintc_wndmgmt_screen_get_default) (void) = NULL;
void (*wintc_wndmgmt_shutdown) (void) = NULL;
GdkPixbuf* (*wintc_wndmgmt_window_get_mini_icon) (
WinTCWndMgmtWindow* window
) = NULL;

View File

@@ -23,6 +23,8 @@ WinTCWndMgmtWindow* (*p_wnck_screen_get_active_window) (
) = NULL;
WinTCWndMgmtScreen* (*p_wnck_screen_get_default) (void) = NULL;
void (*p_wnck_shutdown) (void) = NULL;
const gchar* (*p_wnck_window_get_class_instance_name) (
WinTCWndMgmtWindow* window
) = NULL;
@@ -91,6 +93,9 @@ gboolean init_dll_wnck()
p_wnck_screen_get_default =
dlsym(dl_wnck, "wnck_screen_get_default");
p_wnck_shutdown =
dlsym(dl_wnck, "wnck_shutdown");
p_wnck_window_get_class_instance_name =
dlsym(dl_wnck, "wnck_window_get_class_instance_name");
@@ -118,6 +123,7 @@ gboolean init_dll_wnck()
p_wnck_set_client_type == NULL ||
p_wnck_screen_get_active_window == NULL ||
p_wnck_screen_get_default == NULL ||
p_wnck_shutdown == NULL ||
p_wnck_window_get_class_instance_name == NULL ||
p_wnck_window_get_icon_is_fallback == NULL ||
p_wnck_window_get_mini_icon == NULL ||

View File

@@ -27,6 +27,8 @@ extern WinTCWndMgmtWindow* (*p_wnck_screen_get_active_window) (
);
extern WinTCWndMgmtScreen* (*p_wnck_screen_get_default) (void);
extern void (*p_wnck_shutdown) (void);
extern const gchar* (*p_wnck_window_get_class_instance_name) (
WinTCWndMgmtWindow* Window
);

View File

@@ -33,6 +33,7 @@ gboolean init_wndmgmt_wnck_impl(void)
//
wintc_wndmgmt_screen_get_active_window = p_wnck_screen_get_active_window;
wintc_wndmgmt_screen_get_default = p_wnck_screen_get_default;
wintc_wndmgmt_shutdown = p_wnck_shutdown;
wintc_wndmgmt_window_get_mini_icon = &wnck_window_get_mini_icon_real;
wintc_wndmgmt_window_get_name = p_wnck_window_get_name;
wintc_wndmgmt_window_is_skip_tasklist = p_wnck_window_is_skip_tasklist;

View File

@@ -10,6 +10,7 @@
//
// FORWARD DECLARATIONS
//
static void xfw_shutdown(void);
static GdkPixbuf* xfw_window_get_mini_icon(
WinTCWndMgmtWindow* window
);
@@ -36,6 +37,7 @@ gboolean init_wndmgmt_xfw_impl(void)
//
wintc_wndmgmt_screen_get_active_window = p_xfw_screen_get_active_window;
wintc_wndmgmt_screen_get_default = p_xfw_screen_get_default;
wintc_wndmgmt_shutdown = &xfw_shutdown;
wintc_wndmgmt_window_get_mini_icon = &xfw_window_get_mini_icon;
wintc_wndmgmt_window_get_name = p_xfw_window_get_name;
wintc_wndmgmt_window_is_skip_tasklist = p_xfw_window_is_skip_tasklist;
@@ -47,6 +49,11 @@ gboolean init_wndmgmt_xfw_impl(void)
// PRIVATE FUNCTIONS
//
static void xfw_shutdown(void)
{
// Nothing to do! xfce4windowing doesn't expose any shutdown method
}
static GdkPixbuf* xfw_window_get_mini_icon(
WinTCWndMgmtWindow* window
)

View File

@@ -25,6 +25,10 @@ typedef WinTCIShextView* (*LookupViewFunc) (
//
// FORWARD DECLARATIONS
//
static void wintc_shext_host_finalize(
GObject* object
);
WinTCIShextView* lookup_view_for_path_by_guid(
WinTCShextHost* host,
const gchar* path,
@@ -73,8 +77,13 @@ G_DEFINE_TYPE(
)
static void wintc_shext_host_class_init(
WINTC_UNUSED(WinTCShextHostClass* klass)
) {}
WinTCShextHostClass* klass
)
{
GObjectClass* object_class = G_OBJECT_CLASS(klass);
object_class->finalize = wintc_shext_host_finalize;
}
static void wintc_shext_host_init(
WinTCShextHost* self
@@ -96,6 +105,21 @@ static void wintc_shext_host_init(
);
}
//
// CLASS VIRTUAL METHODS
//
static void wintc_shext_host_finalize(
GObject* object
)
{
WinTCShextHost* host = WINTC_SHEXT_HOST(object);
g_hash_table_unref(host->map_views_by_guid);
g_hash_table_unref(host->map_views_by_mime);
(G_OBJECT_CLASS(wintc_shext_host_parent_class))->finalize(object);
}
//
// PUBLIC FUNCTIONS
//

View File

@@ -272,6 +272,7 @@ static const gchar* translate_widget_text(
if (!g_regex_match(s_langstr_regex, widget_text, 0, &match_info))
{
g_match_info_unref(match_info);
return ret;
}