Hi! I've been developing and maintaining an extension for Thunar (https://github.com/althonos/thunar-torrent-property), but I can't get it to compile anymore with the newest glib. The code won't compile because of a missing `glib_autoptr_clear_ThunarxPropertyPage` function, which is needed when using the `G_DECLARE_FINAL_TYPE` macro to subclass the `ThunarxPropertyPage` type. From what I've tracked, Thunarx code is missing `G_DEFINE_AUTOPTR_CLEANUP_FUNC(ThunarxPropertyPage, g_object_unref)`.
Thanks for reporting ! I have only glibc 2.29 here (debian bullseye), so I cannot reproduce the bug. Patches would be very welcome !
Works for me, Arch Linux with glib 2.62.3. Are you using clang instead of gcc? Please give more info about your build environment.
(In reply to alexxcons from comment #1) > Patches would be very welcome ! I managed to get it to work by editing the Thunarx code, i'll add a patch. (In reply to Andre Miranda from comment #2) > Are you using clang instead of gcc? Please give more info about your build > environment. I'm building with GCC 9.2.0, GLib 2.62.3, Gtk+ 3.24.13. > Works for me, Arch Linux with glib 2.62.3. When compiling the extension I wrote (mentioned above), I get the following compilation errors from GCC (not all of them included, only the first error): ``` /home/althonos/Code/thunar-torrent-property/src/torrent-page.h: In function ‘glib_autoptr_clear_TorrentPage’: /usr/include/glib-2.0/glib/gmacros.h:1028:49: error: ‘glib_autoptr_clear_ThunarxPropertyPage’ undeclared (first use in this function); did you mean ‘glib_autoptr_clear_TorrentPage’? 1028 | #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName | ^~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:1045:18: note: in definition of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ 1045 | { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ | ^~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:1056:65: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ 1056 | _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1408:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CHAINUP’ 1408 | _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/althonos/Code/thunar-torrent-property/src/torrent-page.h:11:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’ 11 | G_DECLARE_FINAL_TYPE(TorrentPage, torrent_page, TORRENT, PAGE, ThunarxPropertyPage); | ^~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:1028:49: note: each undeclared identifier is reported only once for each function it appears in 1028 | #define _GLIB_AUTOPTR_CLEAR_FUNC_NAME(TypeName) glib_autoptr_clear_##TypeName | ^~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:1045:18: note: in definition of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’ 1045 | { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ | ^~~~~~~ /usr/include/glib-2.0/glib/gmacros.h:1056:65: note: in expansion of macro ‘_GLIB_AUTOPTR_CLEAR_FUNC_NAME’ 1056 | _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(ModuleObjName, ParentName, _GLIB_AUTOPTR_CLEAR_FUNC_NAME(ParentName)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/glib-2.0/gobject/gtype.h:1408:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CHAINUP’ 1408 | _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/althonos/Code/thunar-torrent-property/src/torrent-page.h:11:1: note: in expansion of macro ‘G_DECLARE_FINAL_TYPE’ 11 | G_DECLARE_FINAL_TYPE(TorrentPage, torrent_page, TORRENT, PAGE, ThunarxPropertyPage); ```
Created attachment 9304 Patch to add autoptr cleanup support.
Comment on attachment 9304 Patch to add autoptr cleanup support. This patch adds a declaration of autoptr cleanup for every class defined in the thunarx library using the `G_DEFINE_AUTOPTR_CLEANUP_FUNC`. This allows the `G_DECLARE_FINAL_TYPE` macro to be used with Thunarx classes as parents.
Created attachment 9312 patch Thank you for the patch! Seems to have no negative side effects as far as I can tell. Ok if I use your name/email from bugzilla for authorship, like attached ? (Best build patches with git format-patch) The attached patch in addition bumps the glib dependency (and some minor styling fixes) .. fine like that ? G_DEFINE_AUTOPTR_CLEANUP_FUNC() is only defined in glib 2.44. The thunar 4.14 branch lists glib 2.42 as dependency. Should be fine to push as well for the stable branch .. even debian stretch already ships glib 2.50.3
Eh, just noticed that I have glib 2.62.3. (and that I checked the glibc version before, not the glib version :P ) So my setup: glib 2.62.3, GCC 9.2.1, 3.24.12 Just cloned and build "thunar-torrent-property" ... build runs fine here without the patch. Maybe you are using some special flags for compile ?
Still a problem for you to build without the patch ? Can you try on some other environment, since I guess the environment is to blame. Builds fine for me and Andreldm without the patch.
Closed, since build runs fine for me and AndreLDM, and no further reply from reporter.