private dtor ~nsTimerEvent breaks build in nsTimerImpl.cpp

RESOLVED FIXED

Status

()

defect
--
major
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: ul-mcamafia, Unassigned)

Tracking

({platform})

Trunk
Other
AIX
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11
Build Identifier: cvs tag FIREFOX_3_0_1_RELEASE

the private dtor ~nsTimerEvent() cannot be accessed by nsDeriveSafe<nsTimerEvent>::~nsDerivedSafe() in XPCOMPrt.h
bug is similar but not equal to 239465 and 271245



Reproducible: Always

Steps to Reproduce:
1. Compile on AIX 5.1 with VACPP 6.0, no O/S specific code.

Actual Results:  
"/home/ulink/Src/mozilla/xpcom/threads/nsTimerImpl.cpp", line 461.3:
1540-0300 (S) The "private" member "nsTimerEvent::~nsTimerEvent()"
cannot be accessed.
"../../dist/include/xpcom/nsCOMPtr.h", line 187.7: 1540-0719 (I) The
previous message was produced while processing the implicit member
function "nsDerivedSafe<nsTimerEvent>::~nsDerivedSafe()".
"../../dist/include/xpcom/nsCOMPtr.h", line 187.7: 1540-0700 (I) The
previous message was produced while processing "class
nsDerivedSafe<nsTimerEvent>".
"/home/ulink/Src/mozilla/xpcom/threads/nsTimerImpl.cpp", line 495.10:
1540-0700 (I) The previous message was produced while processing
"nsTimerImpl::PostTimerEvent()".


Expected Results:  
successful build in directory xpcom/threads

patch suggested:

Index: mozilla/xpcom/threads/nsTimerImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/threads/nsTimerImpl.cpp,v
retrieving revision 1.46
diff -u -8 -p -r1.46 nsTimerImpl.cpp
--- mozilla/xpcom/threads/nsTimerImpl.cpp       10 Mar 2008 21:05:46 -0000
1.46
+++ mozilla/xpcom/threads/nsTimerImpl.cpp       18 Jul 2008 07:20:53 -0000
@@ -452,24 +452,27 @@ public:
     // timer is already addref'd for us
     MOZ_COUNT_CTOR(nsTimerEvent);
   }

 #ifdef DEBUG_TIMERS
   PRIntervalTime mInitTime;
 #endif

-private:
+// make private dtor accessible for nsDeriveSafe later
+// private dtor breaks build like Bug 239465 and 271245 
+protected:
   ~nsTimerEvent() {
 #ifdef DEBUG
     if (mTimer)
       NS_WARNING("leaking reference to nsTimerImpl");
 #endif
     MOZ_COUNT_DTOR(nsTimerEvent);
   }
+  private:

   nsTimerImpl *mTimer;
   PRInt32      mGeneration;
 };

 NS_IMETHODIMP nsTimerEvent::Run()
 {
   nsRefPtr<nsTimerImpl> timer;
Version: unspecified → 1.9.0 Branch
The build environment can produce a working Firefox 2.0.0.16 and Seamonkey 1.1.11
OS: Other → AIX
Attachment #331299 - Flags: review?
Attachment #331299 - Flags: approval1.9.0.2?
Attachment #331299 - Flags: review? → review?(benjamin)
Attachment #331299 - Flags: approval1.9.0.2?
Keywords: checkin-needed
Comment on attachment 331299 [details] [diff] [review]
suggested patch for making dtor accessible

make the dtor protected is the minimal change for making nsTimerImpl.cpp compile with VACPP 6
This is the stderr output compiling with VisualAge 6:

$ /usr/vacpp/bin/xlC testcase.cpp -o test-vac
"testcase.cpp", line 17.3: 1540-0300 (S) The "private" member "A::~A()" cannot b
e accessed.
"testcase.cpp", line 2.7: 1540-0719 (I) The previous message was produced while
processing the implicit member function "D<class A>::~D()".
"testcase.cpp", line 27.3: 1540-0700 (I) The previous message was produced while
 processing "main()".


And this is the output of compilation with GCC 3.3.2:

$ g++ testcase.cpp -Wall -o test
testcase.cpp:9: warning: `class A' only defines a private destructor and has no
   friends
testcase.cpp: In constructor `D<T>::D() [with T = A]':
testcase.cpp:26:   instantiated from here
testcase.cpp:18: error: `A::~A()' is private
testcase.cpp:5: error: within this context
testcase.cpp: In destructor `D<A>::~D()':
testcase.cpp:18: error: `A::~A()' is private
testcase.cpp:26: error: within this context
$

making A::~A() protected (or public) and testcase.cpp compiles with both compilers w/o errors or warnings.
Version: 1.9.0 Branch → Trunk
Fixed by bug 279210
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Attachment #331299 - Flags: review?(benjamin) → review-
You need to log in before you can comment on or make changes to this bug.