Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Fix picture's content being cleared automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Aug 21, 2024
1 parent fa34452 commit 901e19c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/Adwaita/View/Picture+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ extension Picture {
return inspect { storage, updateProperties in
if updateProperties {
let pointer = storage.opaquePointer
guard let data, data != storage.fields[oldData] as? Data else {
gtk_picture_set_paintable(pointer, gdk_paintable_new_empty(0, 0))
guard let data else {
if storage.fields[oldData] != nil {
gtk_picture_set_paintable(pointer, gdk_paintable_new_empty(0, 0))
storage.fields[oldData] = nil
}
return
}
guard data != storage.fields[oldData] as? Data else {
return
}
let bytes = data.withUnsafeBytes { ptr in
Expand Down

0 comments on commit 901e19c

Please sign in to comment.