Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In callbacks, convert inputs and outputs between pointers and objects #45

Merged
merged 7 commits into from
Nov 12, 2023

Conversation

jwahlstrand
Copy link
Member

@jwahlstrand jwahlstrand commented Nov 10, 2023

In callbacks (not signal handlers, these are function inputs to methods that get called by the C libraries) we have had to convert pointer arguments to GObjects and return pointers rather than the GObjects. This modifies the GI-generated callback functions to do that automatically, which makes the user-supplied callbacks shorter and cleaner. This also automatically adds a reference to GObject pointers on the output where appropriate. The lack of this extra reference was causing segfaults for me in GtkListViews that used GtkTreeListModel. I'm thinking for consistency this should be done in the @cfunction based signal handlers too. This is a breaking change since it affects how callbacks should be written.

Also adds some crude documentation for GtkListView, GtkColumnView, GtkCustomFilter, and GtkCustomSorter and miscellaneous other fixes.

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2023

Codecov Report

Merging #45 (25b7ec8) into main (09682e4) will decrease coverage by 0.29%.
The diff coverage is 56.62%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
- Coverage   84.72%   84.44%   -0.29%     
==========================================
  Files          43       43              
  Lines        4543     4608      +65     
==========================================
+ Hits         3849     3891      +42     
- Misses        694      717      +23     
Files Coverage Δ
src/GLib/gobject.jl 93.58% <ø> (ø)
src/GLib/gtype.jl 89.78% <100.00%> (+0.05%) ⬆️
src/Gtk4.jl 80.76% <ø> (ø)
src/displays.jl 100.00% <100.00%> (ø)
src/input.jl 93.75% <100.00%> (ø)
src/GLib/GLib.jl 91.46% <50.00%> (-2.13%) ⬇️
GI/src/giimport.jl 83.31% <81.08%> (-0.19%) ⬇️
src/lists.jl 62.50% <30.76%> (-1.31%) ⬇️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@jwahlstrand jwahlstrand changed the title In callbacks, convert inputs from pointers to objects In callbacks, convert inputs and outputs between pointers and objects Nov 12, 2023
@jwahlstrand jwahlstrand merged commit 043eb29 into main Nov 12, 2023
11 checks passed
@jwahlstrand jwahlstrand deleted the jw/convertincallbacks branch November 12, 2023 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants