richedit: Fixed Valgrind error related to undoing

Dylan Smith dylan.ah.smith at gmail.com
Sun Jun 29 12:50:20 CDT 2008


Ignore this patch, I still need to work on it.

I ran the test again under valgrind the key events were not getting sent
at first in test_EM_AUTOURLDETECT, and then started working after
some point.  I'll resubmit it when it is done properly.

On Sat, Jun 28, 2008 at 11:36 AM, Dylan Smith <dylan.ah.smith at gmail.com> wrote:
> The error was a memory access of a freed object.  In ME_AddUndoItem I
> checked the top of the undo stack to end a coalescing undo transaction,
> assuming that this should be either a valid undo item, or NULL, instead
> it was already freed.
>
> The undo item being added was actually being added to the redo stack by
> ME_Undo, and before this was done the top of the undo stack was
> destroyed by not set to NULL, thus causing the valgrind error.
>
> I fixed this in two places. First of all I moved my code to
> conditionally turn a coalescing end transaction into an actual end
> transaction, since it doesn't need to be done when adding to the redo
> stack.  Second of all, I made sure the undo and redo stack are in
> valid states for ME_Undo and ME_Redo before calling ME_AddUndoItem or
> ME_PlayItem since I could see someone else making the same assumption.
> This should fix the error and make it harder for a regression to occur.
> ---
>  dlls/riched20/undo.c |   37 +++++++++++++++++++------------------
>  1 files changed, 19 insertions(+), 18 deletions(-)
>



More information about the wine-devel mailing list