Skip to content

Commit

Permalink
Add missing refcount increment
Browse files Browse the repository at this point in the history
  • Loading branch information
serenity4 committed Jan 24, 2025
1 parent 9a9561e commit 53fad94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/tutorial/resource_management.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set_driver(:SwiftShader) # hide

Vulkan.set_preferences!("LOG_DESTRUCTION" => "true")

# You will need to restart your session and import Vulkan again, for changes to take effect.
# Now let's create a bunch of handles and see what happens when the GC runs:

function do_something()
Expand Down
1 change: 1 addition & 0 deletions src/prewrap/handles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function depends_on(x::Vk.Handle, handle::Vk.Handle)
end

function depends_on(x, handle::Vk.Handle)
Vk.increment_refcount!(handle)
T = typeof(x)
ismutabletype(T) || error("`x` must be a mutable object or a `Vk.Handle`")
finalizer(_ -> handle.destructor(), x)
Expand Down

0 comments on commit 53fad94

Please sign in to comment.