Bug 1027251 - Fix or whitelist dangerous public destructors in widget/ - r=roc
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 20 Jun 2014 07:08:25 -0400
changeset 189767 8e05708379ffe13bbe159dfc0439f901b70aab17
parent 189766 fc29e89ab9b12f4a36b5b3c8ae80b71098e789dc
child 189768 77aa55e45693239251b4977fedcf5f268bb6d1ba
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc
bugs1027251
milestone33.0a1
Bug 1027251 - Fix or whitelist dangerous public destructors in widget/ - r=roc
widget/TextRange.h
widget/shared/nsShmImage.h
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -158,16 +158,18 @@ struct TextRange
   }
 };
 
 /******************************************************************************
  * mozilla::TextRangeArray
  ******************************************************************************/
 class TextRangeArray MOZ_FINAL : public nsAutoTArray<TextRange, 10>
 {
+  ~TextRangeArray() {}
+
   NS_INLINE_DECL_REFCOUNTING(TextRangeArray)
 
 public:
   bool IsComposing() const
   {
     for (uint32_t i = 0; i < Length(); ++i) {
       if (ElementAt(i).IsClause()) {
         return true;
--- a/widget/shared/nsShmImage.h
+++ b/widget/shared/nsShmImage.h
@@ -44,26 +44,28 @@ public:
 
     static bool UseShm();
     static already_AddRefed<nsShmImage>
         Create(const gfxIntSize& aSize, Visual* aVisual, unsigned int aDepth);
     static already_AddRefed<gfxASurface>
         EnsureShmImage(const gfxIntSize& aSize, Visual* aVisual, unsigned int aDepth,
                        nsRefPtr<nsShmImage>& aImage);
 
+private:
     ~nsShmImage() {
         if (mImage) {
             mozilla::FinishX(DISPLAY());
             if (mXAttached) {
                 XShmDetach(DISPLAY(), &mInfo);
             }
             XDestroyImage(mImage);
         }
     }
 
+public:
     already_AddRefed<gfxASurface> AsSurface();
 
 #if (MOZ_WIDGET_GTK == 2)
     void Put(GdkWindow* aWindow, GdkRectangle* aRects, GdkRectangle* aEnd);
 #elif (MOZ_WIDGET_GTK == 3)
     void Put(GdkWindow* aWindow, cairo_rectangle_list_t* aRects);
 #elif defined(MOZ_WIDGET_QT)
     void Put(QWindow* aWindow, QRect& aRect);