Commit f2a7fb25 authored by Jody Goldberg's avatar Jody Goldberg

Fix Bug 2036. Be more careful about freeing clipboard data.

Fix Bug 2036.
Be more careful about freeing clipboard data.
parent c08d3a84
1999-09-02 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Check that another
workbook has not already freed the selection before releasing.
(x_selection_received) : Ditto.
(x_clipboard_bind_workbook) : Init clipboard_paste_callback_data.
1999-09-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_update_coords) : Scale movements by
zoom factor.
* src/sheet-object-widget.c (sheet_object_widget_update_coords) : Ditto.
1999-09-01 Jody Goldberg <jgoldberg@home.com> 1999-09-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_compute_col_row_new_size) : * src/sheet.c (sheet_compute_col_row_new_size) :
......
1999-09-02 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_paste_region) : Check that another
workbook has not already freed the selection before releasing.
(x_selection_received) : Ditto.
(x_clipboard_bind_workbook) : Init clipboard_paste_callback_data.
1999-09-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_update_coords) : Scale movements by
zoom factor.
* src/sheet-object-widget.c (sheet_object_widget_update_coords) : Ditto.
1999-09-01 Jody Goldberg <jgoldberg@home.com> 1999-09-01 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_compute_col_row_new_size) : * src/sheet.c (sheet_compute_col_row_new_size) :
......
...@@ -359,8 +359,10 @@ x_selection_received (GtkWidget *widget, GtkSelectionData *sel, guint time, gpoi ...@@ -359,8 +359,10 @@ x_selection_received (GtkWidget *widget, GtkSelectionData *sel, guint time, gpoi
clipboard_release (content); clipboard_release (content);
/* Remove our used resources */ /* Remove our used resources */
g_free (wb->clipboard_paste_callback_data); if (wb->clipboard_paste_callback_data != NULL) {
wb->clipboard_paste_callback_data = NULL; g_free (wb->clipboard_paste_callback_data);
wb->clipboard_paste_callback_data = NULL;
}
} }
/** /**
...@@ -400,11 +402,13 @@ x_selection_clear (GtkWidget *widget, GdkEventSelection *event, Workbook *wb) ...@@ -400,11 +402,13 @@ x_selection_clear (GtkWidget *widget, GdkEventSelection *event, Workbook *wb)
* x_clipboard_bind_workbook: * x_clipboard_bind_workbook:
* *
* Binds the signals related to the X selection to the Workbook * Binds the signals related to the X selection to the Workbook
* and initialized the clipboard data structures for the Workbook.
*/ */
void void
x_clipboard_bind_workbook (Workbook *wb) x_clipboard_bind_workbook (Workbook *wb)
{ {
wb->have_x_selection = FALSE; wb->have_x_selection = FALSE;
wb->clipboard_paste_callback_data = NULL;
gtk_signal_connect ( gtk_signal_connect (
GTK_OBJECT (wb->toplevel), "selection_clear_event", GTK_OBJECT (wb->toplevel), "selection_clear_event",
...@@ -543,7 +547,7 @@ clipboard_paste_region (CellRegion *region, Sheet *dest_sheet, ...@@ -543,7 +547,7 @@ clipboard_paste_region (CellRegion *region, Sheet *dest_sheet,
g_return_if_fail (dest_sheet != NULL); g_return_if_fail (dest_sheet != NULL);
g_return_if_fail (IS_SHEET (dest_sheet)); g_return_if_fail (IS_SHEET (dest_sheet));
if (dest_sheet->workbook->clipboard_paste_callback_data){ if (dest_sheet->workbook->clipboard_paste_callback_data != NULL) {
g_free (dest_sheet->workbook->clipboard_paste_callback_data); g_free (dest_sheet->workbook->clipboard_paste_callback_data);
dest_sheet->workbook->clipboard_paste_callback_data = NULL; dest_sheet->workbook->clipboard_paste_callback_data = NULL;
} }
...@@ -580,8 +584,11 @@ clipboard_paste_region (CellRegion *region, Sheet *dest_sheet, ...@@ -580,8 +584,11 @@ clipboard_paste_region (CellRegion *region, Sheet *dest_sheet,
sheet_paste_selection (dest_sheet, content, dest_sheet->selections->data, data); sheet_paste_selection (dest_sheet, content, dest_sheet->selections->data, data);
workbook_holding_selection->clipboard_paste_callback_data = NULL; /* Check that this has not already been freed */
g_free (data); if (workbook_holding_selection->clipboard_paste_callback_data != NULL) {
workbook_holding_selection->clipboard_paste_callback_data = NULL;
g_free (data);
}
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment