diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-11-24 08:37:53 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-11-24 08:37:53 +0100 |
commit | 1bf62485f701b52ae27433e3570ac24cd7da886f (patch) | |
tree | 0f7be6ad3efd0c75fdad81d8bef5513d477f8d11 /src/PhotoPage.vala | |
parent | 008bc99860fd353a5da5d06e6be5937f4a358aed (diff) | |
parent | a7f185a9852392d1d6290771db6289c97c401a36 (diff) |
Merge branch 'release/debian/0.32.3-1'debian/0.32.3-1
Diffstat (limited to 'src/PhotoPage.vala')
-rw-r--r-- | src/PhotoPage.vala | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala index 10ebb10..a279d89 100644 --- a/src/PhotoPage.vala +++ b/src/PhotoPage.vala @@ -78,17 +78,24 @@ public class ZoomBuffer : Object { private TransformationJob? demand_transform_job = null; // only 1 demand transform job can be // active at a time private Workers workers = null; - private SinglePhotoPage parent_page; + private unowned SinglePhotoPage parent_page; private bool is_interactive_redraw_in_progress = false; public ZoomBuffer(SinglePhotoPage parent_page, Photo backing_photo, Gdk.Pixbuf preview_image) { this.parent_page = parent_page; + this.parent_page.add_weak_pointer(&this.parent_page); this.preview_image = preview_image; this.backing_photo = backing_photo; this.workers = new Workers(2, false); } + ~ZoomBuffer() { + if (this.parent_page != null) { + this.parent_page.remove_weak_pointer(&this.parent_page); + } + } + private void on_iso_source_fetch_complete(BackgroundJob job) { IsoSourceFetchJob fetch_job = (IsoSourceFetchJob) job; if (fetch_job.fetched == null) { @@ -103,7 +110,7 @@ public class ZoomBuffer : Object { } object_state = ObjectState.SOURCE_NOT_TRANSFORMED; - if (!is_interactive_redraw_in_progress) + if (!is_interactive_redraw_in_progress && parent_page != null) parent_page.repaint(); BackgroundJob transformation_job = new TransformationJob(this, iso_source_image, @@ -140,7 +147,7 @@ public class ZoomBuffer : Object { demand_transform_cached_pixbuf = transform_job.transformed; demand_transform_job = null; - parent_page.repaint(); + if (parent_page != null) parent_page.repaint(); } // passing a 'reduced_pixbuf' that has one-quarter the number of pixels as the 'iso_pixbuf' is |