[PATCH] riched20: Don't create too many IRichEditOle interfaces for a RichEdit.

Huw Davies huw at codeweavers.com
Wed Jun 25 03:24:22 CDT 2014


On Wed, Jun 25, 2014 at 01:59:42PM +0800, Jactry Zeng wrote:
> @@ -1502,6 +1503,13 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
>  {
>      IRichEditOleImpl *reo;
>  
> +    if (editor->reOle)
> +    {
> +        reo = editor->reOle;
> +        reo->ref++;
> +        *ppObj = reo;
> +        return 1;
> +    }
>      reo = heap_alloc(sizeof(IRichEditOleImpl));
>      if (!reo)
>          return 0;

This is not the way to do this.  You want to be calling AddRef
on the interface.  You probably want to do the if(editor->reOle)
check in the EM_GETOLEINTERFACE handler and only call this
constructor when needed.

Huw.



More information about the wine-devel mailing list