[PATCH] fixed NULL ptr crash

Jacek Caban jacek at codeweavers.com
Wed Oct 25 15:33:44 CDT 2006


Marcus Meissner wrote:
> On Sun, Sep 16, 2001 at 10:00:00PM +0000, Marcus Meissner wrote:
>   
>> Hi,
>>
>> If nsIWebBrowser_GetContentDOMWindow fails we must
>> not deallocate dom_window ... Only after the nsres
>> check.
>>
>> Ciao, Marcus
>>
>> ---
>>
>>  dlls/mshtml/olecmd.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> f44a99d8c152ad21911b2d3ac42f84211d9a734d
>> diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
>> index fa4afb4..0ab2ad6 100644
>> --- a/dlls/mshtml/olecmd.c
>> +++ b/dlls/mshtml/olecmd.c
>> @@ -422,12 +422,12 @@ static void setup_ns_editing(NSContainer
>>      }
>>  
>>      nsres = nsIWebBrowser_GetContentDOMWindow(This->webbrowser, &dom_window);
>> -    nsIDOMWindow_Release(dom_window);
>>      if(NS_FAILED(nsres)) {
>>          ERR("Could not get content DOM window: %08x\n", nsres);
>>          nsIEditingSession_Release(editing_session);
>>          return;
>>      }
>> +    nsIDOMWindow_Release(dom_window);
>>  
>>      nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE);
>>      nsIEditingSession_Release(editing_session);
>>     
>
> Looking back this does not make sense either, since dom_window is now invalid after the release,
> but we access it.
>
> Jacek, can you check there?
>
>   
You're right, it's my bug. dom_window should be released after
MakeWindowEditable call.

Thanks,
    Jacek



More information about the wine-devel mailing list