Closed
Bug 478113
Opened 17 years ago
Closed 17 years ago
nsMsgDBView::GetCellValue leaks strings
Categories
(MailNews Core :: Backend, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Bienvenu, Assigned: Bienvenu)
Details
(Keywords: memory-leak)
Attachments
(1 file)
|
2.81 KB,
patch
|
neil
:
review+
neil
:
superreview+
|
Details | Diff | Splinter Review |
nsMsgDBView::GetCellValue .Assigns the result of nsMsgDBView::GetString() to nsCStrings - afaict, this is a memory leak because GetString returns an allocated buffer, and we should be using .Adopt. GetCellValue is used by screen readers, I believe.
Attachment #361870 -
Flags: superreview?(neil)
Attachment #361870 -
Flags: review?(neil)
Comment 1•17 years ago
|
||
Comment on attachment 361870 [details] [diff] [review]
proposed fix
>+ aValue.Adopt(GetString (isContainerOpen ?
>+ NS_LITERAL_STRING("messageExpanded").get()
>+ : NS_LITERAL_STRING("messageCollapsed").get()));
Nit: personally I prefer the : at the end of the previous line.
>+ aValue.Adopt(GetString ((flags & nsMsgMessageFlags::Read) ?
>+ EmptyString().get() : NS_LITERAL_STRING("messageUnread").get()));
I wonder why we bother calling GetString on an empty string. I was thinking along the lines of
if (flags & nsMsgMessageFlags::Read)
aValue.Truncate();
else
aValue.Adopt(GetString(NS_LITERAL_STRING("messageUnread").get()));
Attachment #361870 -
Flags: superreview?(neil)
Attachment #361870 -
Flags: superreview+
Attachment #361870 -
Flags: review?(neil)
Attachment #361870 -
Flags: review+
| Assignee | ||
Comment 2•17 years ago
|
||
I've made this match GetCellText, i.e., truncate aValue before the switch, and then just do .Adopts if the flag condition is right. Fix checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•