Browse Source

port bug 1760839

Bill Gianopoulos 2 years ago
parent
commit
26c44ceeca

+ 53 - 0
comm-central/patches/9999999-port1760839-suite-100a1.patch

@@ -0,0 +1,53 @@
+# HG changeset patch
+# User Bill Gianopoulos <wgianopoulos@gmail.com>
+# Date 1648118339 0
+Bug 9999999 - Port bug 1760839 to suite.
+Bug 1760839 - Use more automatic memory management in GTK code.
+
+diff --git a/suite/components/shell/nsGNOMEShellService.cpp b/suite/components/shell/nsGNOMEShellService.cpp
+--- a/suite/components/shell/nsGNOMEShellService.cpp
++++ b/suite/components/shell/nsGNOMEShellService.cpp
+@@ -19,16 +19,17 @@
+ #include "nsIStringBundle.h"
+ #include "nsIOutputStream.h"
+ #include "nsIProcess.h"
+ #include "nsServiceManagerUtils.h"
+ #include "nsComponentManagerUtils.h"
+ #include "nsIImageLoadingContent.h"
+ #include "imgIRequest.h"
+ #include "imgIContainer.h"
++#include "mozilla/GRefPtr.h"
+ #include "mozilla/Sprintf.h"
+ #include "mozilla/dom/Element.h"
+ #if defined(MOZ_WIDGET_GTK)
+ #include "nsImageToPixbuf.h"
+ #endif
+ #include "nsXULAppAPI.h"
+ #include "gfxPlatform.h"
+ 
+@@ -282,24 +283,22 @@ nsGNOMEShellService::GetCanSetDesktopBac
+ 
+   return NS_OK;
+ }
+ 
+ static nsresult WriteImage(const nsCString &aPath, imgIContainer *aImage) {
+ #if !defined(MOZ_WIDGET_GTK)
+   return NS_ERROR_NOT_AVAILABLE;
+ #else
+-  GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(aImage);
++  RefPtr<GdkPixbuf> pixbuf = nsImageToPixbuf::ImageToPixbuf(aImage);
+   if (!pixbuf) {
+     return NS_ERROR_NOT_AVAILABLE;
+   }
+ 
+   gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
+-
+-  g_object_unref(pixbuf);
+   return res ? NS_OK : NS_ERROR_FAILURE;
+ #endif
+ }
+ 
+ NS_IMETHODIMP
+ nsGNOMEShellService::SetDesktopBackground(dom::Element* aElement,
+                                           int32_t aPosition,
+                                           const nsACString& aImageName)

+ 1 - 0
comm-central/patches/series

@@ -1,3 +1,4 @@
+9999999-port1760839-suite-100a1.patch
 TOP-1642188-remove-nsDOMIEvent-cc.patch
 TOP-1611010-DOMEventListener-cc.patch
 TOP-1614671-port1456035-4-and-5-61a1-cc.patch