Port Bug 1299489 Change nsTArray to use a custom iterator based on index instead of pointers to improve iterator invalidation safety of ranged for loops

RESOLVED FIXED in Thunderbird 53.0

Status

MailNews Core
Backend
--
blocker
RESOLVED FIXED
5 months ago
5 months ago

People

(Reporter: aryx, Assigned: Jorg K (GMT+2))

Tracking

unspecified
Thunderbird 53.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

comm-central closed for this.

From my Try-comm-central build:

https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=6760ba026a0327290009bd48db6ee8be0af6e3bc&selectedJob=26131

Log: https://treeherder.mozilla.org/logviewer.html#?job_id=26131&repo=try-comm-central

/builds/slave/tb-try-c-cen-l64-d-00000000000/build/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.5/../../../../x86_64-unknown-linux-gnu/bin/as: /lib64/libz.so.1: no version information available (required by /builds/slave/tb-try-c-cen-l64-d-00000000000/build/gcc/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.5/../../../../x86_64-unknown-linux-gnu/bin/as)
/builds/slave/tb-try-c-cen-l64-d-00000000000/build/mailnews/base/util/nsMsgKeyArray.cpp: In member function 'virtual nsresult nsMsgKeyArray::GetArray(uint32_t*, nsMsgKey**)':
/builds/slave/tb-try-c-cen-l64-d-00000000000/build/mailnews/base/util/nsMsgKeyArray.cpp:75:68: error: no matching function for call to 'nsMemory::Clone(nsTArray_Impl<unsigned int, nsTArrayInfallibleAllocator>::iterator, nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::size_type)'
                                  m_keys.Length() * sizeof(nsMsgKey));
                                                                    ^
/builds/slave/tb-try-c-cen-l64-d-00000000000/build/mailnews/base/util/nsMsgKeyArray.cpp:75:68: note: candidate is:
In file included from /builds/slave/tb-try-c-cen-l64-d-00000000000/build/mailnews/base/util/nsMsgKeyArray.cpp:7:0:
/builds/slave/tb-try-c-cen-l64-d-00000000000/build/objdir-tb/dist/include/nsMemory.h:37:16: note: static void* nsMemory::Clone(const void*, size_t)
   static void*      Clone(const void* aPtr, size_t aSize);
                ^
/builds/slave/tb-try-c-cen-l64-d-00000000000/build/objdir-tb/dist/include/nsMemory.h:37:16: note:   no known conversion for argument 1 from 'nsTArray_Impl<unsigned int, nsTArrayInfallibleAllocator>::iterator {aka nsTArrayIterator<unsigned int>}' to 'const void*'
make[5]: *** [nsMsgKeyArray.o] Error 1
Easiest solution would be to use .Elements() instead of .begin(), as .Elements() still returns the raw pointer to the beginning of the backing store.
(Assignee)

Comment 2

5 months ago
Thanks for reporting this. I thought they are all in Hawaii ;-)

From the log it looks like there is perhaps only one call site affected:
mailnews/base/util/nsMsgKeyArray.cpp:75

I'll look into it.
(Assignee)

Comment 3

5 months ago
Created attachment 8817642 [details] [diff] [review]
1322695-bustagetsarray.patch

If my local compile goes through, I'll land this.

Thanks, Michael.
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
(Assignee)

Comment 4

5 months ago
BTW, same change as here:
https://hg.mozilla.org/mozilla-central/rev/8cc548682ae3#l1.15
https://hg.mozilla.org/mozilla-central/rev/8cc548682ae3#l2.12
(Assignee)

Comment 5

5 months ago
https://hg.mozilla.org/comm-central/rev/41cd3320721d260524a3315ac6d127099c515ff0
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 53.0
You need to log in before you can comment on or make changes to this bug.