Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (1 of 5, fixes for view/). r=tnikkel.
authorJulian Seward <jseward@acm.org>
Tue, 24 Jan 2017 17:10:01 +0100
changeset 330880 a9f258d042482099bbbd9bfd235efbf742959df0
parent 330879 bcbb1d8a9e232ed5c16076f8392c925c95f1b4d5
child 330881 572be1a80312ebaca73456e23211d917237f1a5e
push id31254
push userphilringnalda@gmail.com
push dateWed, 25 Jan 2017 02:53:42 +0000
treeherdermozilla-central@6dccae211ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1232696
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (1 of 5, fixes for view/). r=tnikkel.
view/nsView.cpp
view/nsView.h
view/nsViewManager.cpp
view/nsViewManager.h
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -21,28 +21,37 @@
 #include "mozilla/TimelineConsumers.h"
 #include "mozilla/CompositeTimelineMarker.h"
 
 using namespace mozilla;
 
 static bool sShowPreviousPage = true;
 
 nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
+  : mViewManager(aViewManager)
+  , mParent(nullptr)
+  , mNextSibling(nullptr)
+  , mFirstChild(nullptr)
+  , mFrame(nullptr)
+  , mDirtyRegion(nullptr)
+  , mZIndex(0)
+  , mVis(aVisibility)
+  , mPosX(0)
+  , mPosY(0)
+  , mVFlags(0)
+  , mWidgetIsTopLevel(false)
+  , mForcedRepaint(false)
+  , mNeedsWindowPropertiesSync(false)
 {
   MOZ_COUNT_CTOR(nsView);
 
-  mVis = aVisibility;
   // Views should be transparent by default. Not being transparent is
   // a promise that the view will paint all its pixels opaquely. Views
   // should make this promise explicitly by calling
   // SetViewContentTransparency.
-  mVFlags = 0;
-  mViewManager = aViewManager;
-  mDirtyRegion = nullptr;
-  mWidgetIsTopLevel = false;
 
   static bool sShowPreviousPageInitialized = false;
   if (!sShowPreviousPageInitialized) {
     Preferences::AddBoolVarCache(&sShowPreviousPage, "layout.show_previous_page", true);
     sShowPreviousPageInitialized = true;
   }
 }
 
--- a/view/nsView.h
+++ b/view/nsView.h
@@ -56,17 +56,19 @@ enum nsViewVisibility {
 class nsView final : public nsIWidgetListener
 {
 public:
   friend class nsViewManager;
 
   typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
   typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
 
-  NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
+  void operator delete(void* ptr) {
+    ::operator delete(ptr);
+  }
 
   /**
    * Get the view manager which "owns" the view.
    * This method might require some expensive traversal work in the future. If you can get the
    * view manager from somewhere else, do that instead.
    * @result the view manager
    */
   nsViewManager* GetViewManager() const { return mViewManager; }
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -52,30 +52,31 @@ using namespace mozilla::layers;
 
 #undef DEBUG_MOUSE_LOCATION
 
 // Weakly held references to all of the view managers
 nsTArray<nsViewManager*>* nsViewManager::gViewManagers = nullptr;
 uint32_t nsViewManager::gLastUserEventTime = 0;
 
 nsViewManager::nsViewManager()
-  : mDelayedResize(NSCOORD_NONE, NSCOORD_NONE)
+  : mPresShell(nullptr)
+  , mDelayedResize(NSCOORD_NONE, NSCOORD_NONE)
+  , mRootView(nullptr)
+  , mRootViewManager(this)
+  , mRefreshDisableCount(0)
+  , mPainting(false)
+  , mRecursiveRefreshPending(false)
+  , mHasPendingWidgetGeometryChanges(false)
 {
-  mRootViewManager = this;
   if (gViewManagers == nullptr) {
     // Create an array to hold a list of view managers
     gViewManagers = new nsTArray<nsViewManager*>;
   }
  
   gViewManagers->AppendElement(this);
-
-  // NOTE:  we use a zeroing operator new, so all data members are
-  // assumed to be cleared here.
-  mHasPendingWidgetGeometryChanges = false;
-  mRecursiveRefreshPending = false;
 }
 
 nsViewManager::~nsViewManager()
 {
   if (mRootView) {
     // Destroy any remaining views
     mRootView->Destroy();
     mRootView = nullptr;
--- a/view/nsViewManager.h
+++ b/view/nsViewManager.h
@@ -25,18 +25,16 @@ class nsViewManager final
 {
   ~nsViewManager();
 public:
   friend class nsView;
 
   typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
   typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
 
-  NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
-
   NS_INLINE_DECL_REFCOUNTING(nsViewManager)
 
   nsViewManager();
 
   /**
    * Initialize the ViewManager
    * Note: this instance does not hold a reference to the presshell
    * because it holds a reference to this instance.