[shotwell] Fix set_default_icon_list() ownership transfer bug



commit 5828825fa45784c3a24e0f623c65864a33506bb8
Author: Jim Nelson <jim yorba org>
Date:   Thu Aug 21 13:53:02 2014 -0700

    Fix set_default_icon_list() ownership transfer bug
    
    Ownership of the GList is transferred in this call, so a copy should
    be passed instead.  This will be fixed in a future version of Vala.
    
    Upcoming versions of Vala will also not allow private members in
    structs, so that is removed here as well.
    
    https://mail.gnome.org/archives/vala-list/2014-August/msg00022.html

 src/AppWindow.vala  |    5 ++++-
 src/Dimensions.vala |   22 +++++++++++-----------
 vapi/libraw.vapi    |    6 +++---
 3 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index ec18ef6..782f953 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -447,7 +447,10 @@ public abstract class AppWindow : PageWindow {
         GLib.List<Gdk.Pixbuf> pixbuf_list = new GLib.List<Gdk.Pixbuf>();
         foreach (string resource in Resources.APP_ICONS)
             pixbuf_list.append(Resources.get_icon(resource, 0));
-        set_default_icon_list(pixbuf_list);
+        // Use copy() because set_default_icon_list() actually accepts an owned reference
+        // If we didn't hold the pixbufs in memory, would need to use copy_deep()
+        // See https://mail.gnome.org/archives/vala-list/2014-August/msg00022.html
+        set_default_icon_list(pixbuf_list.copy());
 
         // restore previous size and maximization state
         if (this is LibraryWindow) {
diff --git a/src/Dimensions.vala b/src/Dimensions.vala
index 0c8c895..f689aca 100644
--- a/src/Dimensions.vala
+++ b/src/Dimensions.vala
@@ -249,10 +249,10 @@ public struct Dimensions {
 public struct Scaling {
     private const int NO_SCALE = 0;
     
-    private ScaleConstraint constraint;
-    private int scale;
-    private Dimensions viewport;
-    private bool scale_up;
+    public ScaleConstraint constraint;
+    public int scale;
+    public Dimensions viewport;
+    public bool scale_up;
     
     private Scaling(ScaleConstraint constraint, int scale, Dimensions viewport, bool scale_up) {
         this.constraint = constraint;
@@ -461,13 +461,13 @@ public struct Scaling {
 }
 
 public struct ZoomState {
-    private Dimensions content_dimensions;
-    private Dimensions viewport_dimensions;
-    private double zoom_factor;
-    private double interpolation_factor;
-    private double min_factor;
-    private double max_factor;
-    private Gdk.Point viewport_center;
+    public Dimensions content_dimensions;
+    public Dimensions viewport_dimensions;
+    public double zoom_factor;
+    public double interpolation_factor;
+    public double min_factor;
+    public double max_factor;
+    public Gdk.Point viewport_center;
     
     public ZoomState(Dimensions content_dimensions, Dimensions viewport_dimensions,
         double slider_val = 0.0, Gdk.Point? viewport_center = null) {
diff --git a/vapi/libraw.vapi b/vapi/libraw.vapi
index 53f2461..ad7de61 100644
--- a/vapi/libraw.vapi
+++ b/vapi/libraw.vapi
@@ -37,9 +37,9 @@ public struct ImageParams {
     public int colors;
     public uint filters;
     
-    private char *make;
-    private char *model;
-    private char *cdesc;
+    public char *make;
+    public char *model;
+    public char *cdesc;
     
     public string get_make() {
         return build_string(make, 64);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]