|
@@ -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)
|