Bug 121868 - Use std::unique_ptr for decoders as well
Summary: Use std::unique_ptr for decoders as well
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-24 14:19 PDT by Anders Carlsson
Modified: 2013-09-24 15:18 PDT (History)
1 user (show)

See Also:


Attachments
Patch (22.21 KB, patch)
2013-09-24 14:20 PDT, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (22.39 KB, patch)
2013-09-24 14:27 PDT, Anders Carlsson
no flags Details | Formatted Diff | Diff
Patch (22.31 KB, patch)
2013-09-24 14:32 PDT, Anders Carlsson
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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