Bug 121868

Summary: Use std::unique_ptr for decoders as well
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: ossy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch kling: review+

Description Anders Carlsson 2013-09-24 14:19:16 PDT
Use std::unique_ptr for decoders as well
Comment 1 Anders Carlsson 2013-09-24 14:20:43 PDT
Created attachment 212501 [details]
Patch
Comment 2 Andreas Kling 2013-09-24 14:25:15 PDT
Comment on attachment 212501 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=212501&action=review

> Source/WebKit2/Platform/CoreIPC/Connection.cpp:417
> -        HashMap<std::pair<std::pair<StringReference, StringReference>, uint64_t>, OwnPtr<MessageDecoder>>::iterator it = m_waitForMessageMap.find(messageAndDestination);
> -        if (it->value) {
> -            OwnPtr<MessageDecoder> decoder = it->value.release();
> -            m_waitForMessageMap.remove(it);
> -
> -            return decoder.release();
> -        }
> +        if (std::unique_ptr<MessageDecoder> decoder = m_waitForMessageMap.take(messageAndDestination))
> +            return decoder;

This is wrong, you are now always taking the decoder out of the map!
Comment 3 Anders Carlsson 2013-09-24 14:27:53 PDT
Created attachment 212503 [details]
Patch
Comment 4 Andreas Kling 2013-09-24 14:31:52 PDT
Comment on attachment 212503 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=212503&action=review

> Source/WebKit2/Platform/CoreIPC/Connection.cpp:425
> -        HashMap<std::pair<std::pair<StringReference, StringReference>, uint64_t>, OwnPtr<MessageDecoder>>::iterator it = m_waitForMessageMap.find(messageAndDestination);
> +        auto it = m_waitForMessageMap.find(messageAndDestination);
>          if (it->value) {
> -            OwnPtr<MessageDecoder> decoder = it->value.release();
> +            std::unique_ptr<MessageDecoder> decoder = std::move(it->value);
>              m_waitForMessageMap.remove(it);
>  
> -            return decoder.release();
> +            return decoder;
>          }
> +
> +        if (std::unique_ptr<MessageDecoder> decoder = m_waitForMessageMap.take(messageAndDestination))
> +            return decoder;

Still has the bug. :|
Comment 5 Anders Carlsson 2013-09-24 14:32:39 PDT
Created attachment 212504 [details]
Patch
Comment 6 Anders Carlsson 2013-09-24 14:47:41 PDT
Committed r156360: <http://trac.webkit.org/changeset/156360>
Comment 7 Csaba Osztrogonác 2013-09-24 15:18:42 PDT
(In reply to comment #6)
> Committed r156360: <http://trac.webkit.org/changeset/156360>

Unix buildfix landed in http://trac.webkit.org/changeset/156363