in a lot of my sources i am connecting GTK events with the g_signal_connect_() library function and this works well. At the moment, i am converting all my sources to make them work with unicode mode.
Unfortunately, the GTK imports provided by PureBasic do not use the p-utf8 pseudotype for strings, so all library functions with pointers to strings do not work. An easy workaround is to import the required function with a missing leading dash and use the p-utf8 pseudo type for strings. This works on all functions i have tested, but not with the g_signal_connect() function.
Here is a sample code to test:
Code: Select all
ImportC ""
g_signal_connect(*instance, signal.p-utf8, *handler, *data)
;g_signal_connect_data(*instance, signal.p-utf8, *handler, *data, *destroy_data, *connect_flags)
EndImport
ProcedureC Event()
Debug "destroyed"
EndProcedure
OpenWindow(0, 0, 0, 300, 300, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)
g_signal_connect(WindowID(0), "destroy", @Event(), 0)
;g_signal_connect_data(WindowID(0), "destroy", @Event(), 0, 0, 0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver

If you comment out the g_signal_connect() and uncomment the g_signal_connect_data() lines, you can see that g_signal_connect_data() works as expected.
Does anyone know why this happens?
I hope the PB team will update the library bindings and use p-utf8 if the IDE has moved to unicode mode only.
Best regards
Uwe