gtk_text_buffer_get_text returns a char* which must be g_freed

This commit is contained in:
Christopher Lam 2023-06-26 19:59:48 +08:00
parent eefaeb53ea
commit 2f0577fb34
8 changed files with 14 additions and 6 deletions

View File

@ -521,10 +521,11 @@ gnc_ui_to_account (AccountWindow *aw)
gtk_text_buffer_get_start_iter (aw->notes_text_buffer, &start);
gtk_text_buffer_get_end_iter (aw->notes_text_buffer, &end);
string = gtk_text_buffer_get_text (aw->notes_text_buffer, &start, &end, FALSE);
char *new_string = gtk_text_buffer_get_text (aw->notes_text_buffer, &start, &end, FALSE);
old_string = xaccAccountGetNotes (account);
if (null_strcmp (string, old_string) != 0)
xaccAccountSetNotes (account, string);
if (g_strcmp0 (new_string, old_string))
xaccAccountSetNotes (account, new_string);
g_free (new_string);
flag = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(aw->opening_balance_button));
if (xaccAccountGetIsOpeningBalance (account) != flag)

View File

@ -66,7 +66,7 @@ gcrtv_editing_done (GtkCellEditable *editable,
GncCellRendererTextView *cell_tv)
{
gchar *path;
const gchar *new_text;
gchar *new_text;
if (GNC_CELL_VIEW(editable)->focus_out_id > 0)
{
@ -96,6 +96,8 @@ gcrtv_editing_done (GtkCellEditable *editable,
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE(editable));
g_signal_emit_by_name (cell_tv, "edited", path, new_text);
g_free (new_text);
}
static gboolean

View File

@ -260,7 +260,7 @@ gnc_cell_view_set_text (GncCellView *cv, const gchar *text)
-1);
}
const gchar *
gchar *
gnc_cell_view_get_text (GncCellView *cv)
{
GtkTextIter siter, eiter;

View File

@ -60,6 +60,6 @@ GtkWidget *gnc_cell_view_new (void);
void gnc_cell_view_set_text (GncCellView *cv, const gchar *text);
const gchar *gnc_cell_view_get_text (GncCellView *cv);
gchar *gnc_cell_view_get_text (GncCellView *cv);
#endif /* __GNC_CELL_VIEW_H__ */

View File

@ -258,6 +258,7 @@ static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
gncCustomerCommitEdit (cust);
gnc_resume_gui_refresh ();
g_free (text);
}
static gboolean check_edit_amount (GtkWidget *amount,

View File

@ -441,6 +441,7 @@ static void gnc_ui_to_invoice (InvoiceWindow *iw, GncInvoice *invoice)
gncInvoiceCommitEdit (invoice);
gnc_resume_gui_refresh ();
g_free (text);
}
static gboolean
@ -1522,6 +1523,7 @@ gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event,
gtk_text_buffer_get_bounds (text_buffer, &start, &end);
text = gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE);
gncInvoiceSetNotes (invoice, text);
g_free (text);
return FALSE;
}

View File

@ -154,6 +154,7 @@ static void gnc_ui_to_order (OrderWindow *ow, GncOrder *order)
gncOrderCommitEdit (order);
gnc_resume_gui_refresh ();
g_free (text);
}
static gboolean

View File

@ -178,6 +178,7 @@ static void gnc_ui_to_vendor (VendorWindow *vw, GncVendor *vendor)
gncVendorCommitEdit (vendor);
gnc_resume_gui_refresh ();
g_free (text);
}
static gboolean check_entry_nonempty (GtkWidget *entry,