Closed Bug 1923273 Opened 4 months ago Closed 4 months ago

-Werror=dangling-pointer= - nsTObserverArray.h error: storing the address of local variable ‘__for_begin’

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: Sylvestre, Unassigned)

References

(Blocks 1 open bug)

Details

    inlined from ‘nsAutoTObserverArray<T, N>::STLIteratorRange<Iterator, U>::iterator nsAutoTObserverArray<T, N>::STLIteratorRange<Iterator, U>::begin() const [with Iterator = nsAutoTObserverArray<nsTObserverArray<RefPtr<mozilla::dom::CloseWatcher> >, 0>::BackwardIterator; U = const nsTObserverArray<RefPtr<mozilla::dom::CloseWatcher> >; T = nsTObserverArray<RefPtr<mozilla::dom::CloseWatcher> >; long unsigned int N = 0]’ at /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsTObserverArray.h:457:52,
    inlined from ‘bool mozilla::dom::CloseWatcherManager::Contains(const mozilla::dom::CloseWatcher&) const’ at /root/firefox-gcc-last/dom/closewatcher/CloseWatcherManager.cpp:82:50:
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/nsTObserverArray.h:282:25: error: storing the address of local variable ‘__for_begin’ in ‘*MEM[(const struct nsAutoTObserverArray & *)&D.696792].nsAutoTObserverArray<nsTObserverArray<RefPtr<mozilla::dom::CloseWatcher> >, 0>::<anonymous>.nsTObserverArray_base::mIterators’ [-Werror=dangling-pointer=]
  282 |       aArray.mIterators = this;
      |       ~~~~~~~~~~~~~~~~~~^~~~~~
Summary: error: storing the address of local variable ‘__for_begin’ → nsTObserverArray.h error: storing the address of local variable ‘__for_begin’
Summary: nsTObserverArray.h error: storing the address of local variable ‘__for_begin’ → -Werror=dangling-pointer= - nsTObserverArray.h error: storing the address of local variable ‘__for_begin’
Component: Source Code Analysis → XPCOM
Product: Developer Infrastructure → Core

It's a false positive: the reference is dropped upon destruction of this, see

https://searchfox.org/mozilla-central/source/xpcom/ds/nsTObserverArray.h#290

Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.