Closed jnez137 closed 3 weeks ago
Thanks @jnez137 for pointing this problem.
Indeed, following the issue #277 I had written:
if ("char" in c_type) and (not isReturned):
if declaration.count('*') >= 2:
# An array of C strings:
return "type(c_ptr), dimension(*)", "c_ptr"
I will have to investigate if we can follow the same rule for the GVariant type.
@jnez137 you can have a look in my gtk4-vmagnin development branch at this commit: https://github.com/vmagnin/gtk-fortran/commit/2f7631c9f7cfe65c87792798f0143049d2a78fce
GVariant and GVariantType are now declared as an array of pointers when there are two *
in the C declaration. The functions concerned with this change are:
gtk-fortran 4.7.0 should be released in a few weeks.
HI Vincent,
Thanks! Yes I was able to build this commit and it fixes the issue I had.
Thanks, Jeremy
On Tue, Oct 29, 2024 at 6:43 AM Vincent Magnin @.***> wrote:
@jnez137 https://github.com/jnez137 you can have a look in my gtk4-vmagnin development branch at this commit: 2f7631c https://github.com/vmagnin/gtk-fortran/commit/2f7631c9f7cfe65c87792798f0143049d2a78fce
GVariant and GVariantType are now declared as an array of pointers when there are two * in the C declaration. The functions concerned with this change are:
- gtk_widget_class_query_action
- g_settings_backend_flatten_tree
- g_action_group_query_action
- g_menu_attribute_iter_get_next
- g_action_parse_detailed_name
- g_variant_type_new_tuple
- g_variant_new_tuple
- g_variant_new_array
gtk-fortran 4.7.0 should be released in a few weeks.
— Reply to this email directly, view it on GitHub https://github.com/vmagnin/gtk-fortran/issues/289#issuecomment-2444273357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVX64HM5MBMGN67XIWD2L3Z56GIJAVCNFSM6AAAAABMPCE5YKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBUGI3TGMZVG4 . You are receiving this because you were mentioned.Message ID: @.***>
gtk-fortran 4.7.0 released with the fix.
Describe the bug This is very similar to closed issue https://github.com/vmagnin/gtk-fortran/issues/277 When I try to use g_variant_type_new_tuple it crashes with the following error with the current binding.
Expected behavior I changed the binding to accept a pointer array, recompiled, and it is working as expected.
To Reproduce I was using MacOS. Here is a snippet of code that will reproduce the error, edited from a sub that I use to add Mac key bindings for clipboard cut/copy/paste
If you were to run an application with a textView modified in this way, and click on the textView and use the a shortcut key, you will get the error above.
With the fix I proposed above, the code snippet has to be modified slightly to create a null terminated pointer string
Making this change results in no crash and the selected behavior (the a key binding selects all the text in the textView).
Your system: MacOS gtk4 gtk-fortran.
Additional context This seems similar to issue #277 where the type conversion is not clear. I don't know if there is a more general way to catch these. I also didn't see any evidence of this routine being tested in your examples so I am guessing it has never worked.