Closed Bug 1244466 Opened 9 years ago Closed 9 years ago

Stop using nsAutoPtr for holding primitive arrays in MailNews due to bug 1241901

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 47.0

People

(Reporter: jorgk-bmo, Assigned: jorgk-bmo)

References

Details

Attachments

(1 file, 2 obsolete files)

Looks like this https://hg.mozilla.org/mozilla-central/rev/673a9080e14d broke the compile at least here: c:\mozilla-source\comm-central\obj-i686-pc-mingw32\dist\include\nsAutoPtr.h(26) : error C2338: If you are using nsAutoPtr to hold an array, use UniquePtr<T[]> instead c:/mozilla-source/comm-central/mailnews/base/src/nsMessenger.cpp(154) : see reference to class template instantiation 'nsAutoPtr<char>' being compiled
Attached patch Bustage fix (v1). (obsolete) — Splinter Review
I derived the fix looking at https://hg.mozilla.org/mozilla-central/rev/673a9080e14d#l7.49 I've also tried: -#include "nsAutoPtr.h" +#include "mozilla/UniquePtr.h" - nsAutoPtr<char> m_dataBuffer; + mozilla::UniquePtr<char[]> m_dataBuffer; - m_dataBuffer = new char[FOUR_K]; + m_dataBuffer = mozilla::MakeUnique<char[]>(FOUR_K); but that gave all sorts of hassle where m_dataBuffer is passed as a char*. Luckily there is only one occurrence in the whole C-C tree of this.
Assignee: nobody → mozilla
Status: NEW → ASSIGNED
Attachment #8714015 - Flags: review?(Pidgeot18)
Actually, this needs to change, too: if (m_dataBuffer && m_outputStream)
More tweaks. Sorry.
Attachment #8714015 - Attachment is obsolete: true
Attachment #8714015 - Flags: review?(Pidgeot18)
Attachment #8714018 - Flags: review?(Pidgeot18)
Depends on: 1241901
Summary: Bustage of 30 Jan 2016 due to bug 1241901 → Stop using nsAutoPtr for holding primitive arrays in MailNews due to bug 1241901
(In reply to Jorg K (GMT+1) from comment #1) > but that gave all sorts of hassle where m_dataBuffer is passed as a char*. You probably should replace all of them with m_dataBuffer.get() rather than inline a 4k array in the class.
Attachment #8714024 - Flags: review?(Pidgeot18)
Kent, perhaps you can get to this before Joshua. BTW, the second patch was inspired by https://hg.mozilla.org/mozilla-central/rev/673a9080e14d#l4.32
Flags: needinfo?(rkent)
Comment on attachment 8714018 [details] [diff] [review] Bustage fix (v2). Review of attachment 8714018 [details] [diff] [review]: ----------------------------------------------------------------- This one looks better.
Attachment #8714018 - Flags: review?(Pidgeot18) → review+
Attachment #8714024 - Flags: review?(Pidgeot18)
https://hg.mozilla.org/comm-central/rev/de29414d264853d08ced88a2b416107b18b31607 Bug 1244466 - Port Bug 1241901 part 4 - Stop using nsAutoPtr for holding primitive arrays. r=jcranmer a=aleth CLOSED TREE
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 47.0
Flags: needinfo?(rkent)
Attachment #8714024 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: