mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[assistant-stock-transaction] refresh_handler: avoid leaking GList*
by using scanning the GHashTable directly.
This commit is contained in:
parent
09474bb251
commit
41167e3270
@ -2639,6 +2639,12 @@ stock_assistant_cancel_cb (GtkAssistant *assistant, gpointer user_data)
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
is_destroying (gpointer key, EventInfo* change, gpointer user_data)
|
||||
{
|
||||
return (change->event_mask & QOF_EVENT_DESTROY);
|
||||
};
|
||||
|
||||
static void
|
||||
refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
{
|
||||
@ -2649,16 +2655,11 @@ refresh_handler (GHashTable *changes, gpointer user_data)
|
||||
* should be only one entry, so just get the value and see if it
|
||||
* matches QOF_EVENT_DESTROY.
|
||||
*/
|
||||
auto list = g_hash_table_get_values(changes);
|
||||
for (auto node = list; node; node = g_list_next(node))
|
||||
if (g_hash_table_find (changes, (GHRFunc)is_destroying, nullptr))
|
||||
{
|
||||
auto change{static_cast<EventInfo*>(node->data)};
|
||||
if (change->event_mask & QOF_EVENT_DESTROY)
|
||||
{
|
||||
PWARN ("Stock account destroyed, cancelling assistant.");
|
||||
auto controller = static_cast<StockAssistantController*>(user_data);
|
||||
gnc_close_gui_component_by_data(ASSISTANT_STOCK_TRANSACTION_CM_CLASS, controller);
|
||||
}
|
||||
PWARN ("Stock account destroyed, cancelling assistant.");
|
||||
auto controller = static_cast<StockAssistantController*>(user_data);
|
||||
gnc_close_gui_component_by_data(ASSISTANT_STOCK_TRANSACTION_CM_CLASS, controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user