The default bug view has changed. See this FAQ.

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

RESOLVED FIXED in Thunderbird 47.0

Status

Thunderbird
General
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: Jorg K (GMT+1), Assigned: Jorg K (GMT+1))

Tracking

Trunk
Thunderbird 47.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

a year ago
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
(Assignee)

Comment 1

a year ago
Created attachment 8714015 [details] [diff] [review]
Bustage fix (v1).

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)
(Assignee)

Comment 2

a year ago
Actually, this needs to change, too: if (m_dataBuffer && m_outputStream)
(Assignee)

Comment 3

a year ago
Created attachment 8714018 [details] [diff] [review]
Bustage fix (v2).

More tweaks. Sorry.
Attachment #8714015 - Attachment is obsolete: true
Attachment #8714015 - Flags: review?(Pidgeot18)
Attachment #8714018 - Flags: review?(Pidgeot18)

Updated

a year ago
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.
(Assignee)

Comment 5

a year ago
Created attachment 8714024 [details] [diff] [review]
Alternate patch according to Xidorn's comment #4.
Attachment #8714024 - Flags: review?(Pidgeot18)
(Assignee)

Comment 6

a year ago
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)

Comment 8

a year ago
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

Updated

a year ago
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 47.0

Updated

a year ago
Flags: needinfo?(rkent)

Updated

a year ago
Attachment #8714024 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.