Open jnez137 opened 1 month 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.
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.