• Peter Kasting's avatar
    Prevent segfaults due to bad pointer conversion with inheritance. · 92a78310
    Peter Kasting authored
    If we pass a View* through a void*, we need to cast to View* on the
    other side before any casting to a View subclass, or the pointer will
    not be fixed up correctly.
    
    In this case, we can just pass as a View* directly, avoiding the void*,
    and the cast-to-derived Just Works.
    
    Found this while trying to add metadata to OmniboxViewViews, which
    inherits from views::Textfield but does not have that as the first base
    class.
    
    Bug: none
    Change-Id: I5abc3efc3abbbe470ab23b3579984767f9e51b1b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2625752
    Commit-Queue: Peter Kasting <pkasting@chromium.org>
    Commit-Queue: Wei Li <weili@chromium.org>
    Auto-Submit: Peter Kasting <pkasting@chromium.org>
    Reviewed-by: default avatarWei Li <weili@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#842873}
    92a78310
property_metadata.h 3.4 KB