gEDA-dev: Fixes for [ geda-Bugs-1851403 ] Crash after adding component while in move mode
Peter Clifton
pcjc2 at cam.ac.uk
Sat Dec 15 22:23:22 EST 2007
On Sun, 2007-12-16 at 03:01 +0000, Peter Clifton wrote:
> diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
> index f0f9b10..59bbc7d 100644
> --- a/gschem/src/x_compselect.c
> +++ b/gschem/src/x_compselect.c
> @@ -149,10 +149,8 @@ x_compselect_callback_response (GtkDialog *dialog,
> o_glist_draw_xor(w_current, diff_x, diff_y,
> toplevel->page_current->complex_place_list);
>
> - /* Free the complex place list and its contents */
> - s_delete_object_glist(toplevel,
> - toplevel->page_current->complex_place_list);
> - toplevel->page_current->complex_place_list = NULL;
> + /* Cancel any action / place operation currently in progress */
> + o_redraw_cleanstates (w_current);
>
> if (symbol == NULL) {
> /* If there is no symbol selected, switch to SELECT mode */
>
> This seems to work,
Ok, ignore this.. it introduces a memory leak, as the complex_place_list
isn't free'd in o_redraw_cleanstates().
Oh.. and we probably don't really need / want to redraw here anyway.
Perhaps there is need for a fix in o_redraw_cleanstates() though, as
invoking some action which calls o_redraw_cleanstates() during component
placement (or anything where the complex_place_list contains unowned
objects) will leak. This makes o_redraw_cleanstates more like the cancel
action, so perhaps I can use that.
Gah.. (note to self), there is another possible crash freeing the
complex place list when closing the component selector.
As these changes are what I would call "dangerous", I'll think about
them tomorrow, and hopefully come up with a more comprehensive patch.
Best wishes,
--
Peter Clifton
Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA
Tel: +44 (0)7729 980173 - (No signal in the lab!)
More information about the geda-dev
mailing list