Closed Bug 2089980 Opened 13 days ago Closed 1 day ago

Remove the unused nsProfileLock copy constructor

Categories

(Toolkit :: Startup and Profile System, task)

task

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: Sylvestre, Assigned: jreitano, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Attachments

(1 external file)

Filing as a good first bug to learn workflows.

nsProfileLock(nsProfileLock& src) is implemented as *this = src;, which calls operator= and therefore Unlock() on uninitialized members. Nothing uses this constructor, so delete it (declaration in nsProfileLock.h and definition in nsProfileLock.cpp) or mark it = delete.

Current code:

  nsProfileLock();
  nsProfileLock(nsProfileLock& src);

Link to the code:
https://searchfox.org/firefox-main/source/toolkit/profile/nsProfileLock.h

To verify the fix:

./mach build
./mach gtest 'ProfileLock*'

This was reported by Coverity Scan (CID 1512664). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

I volunteer to work on this bug.

Assignee: nobody → jreitano

It called operator=, and so Unlock(), on uninitialized members. Nothing uses it, so mark it deleted rather than fix it.

Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 1 day ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: