GNOME Bugzilla – Bug 748657
Missing getc_unlocked for demowindow.cc on Windows
Last modified: 2015-05-13 13:34:12 UTC
Created attachment 302589 [details] [review] Use getc if HAVE_GETC_UNLOCKED is not defined MS Windows lacks getc_unlocked. There are alternatives [1], but I'm not sure whether there are alternatives for flockfile / funlockfile, perhaps [2]. Long story short, I find that gtkmm3-demo.exe works okay (shows example source, runs demo) if getc_unlocked is replaced with getc. As mentioned in [1] it can be achieved with preprocessor directives (I prefer for the demo sake), or can be patched (see attachment). P.S. Is there a special reason to use unlocked version? Perhaps if there is a reason, _lock_file, _unlock_file, and _fgetc_nolock shall be used on Windows instead. I can prepare a modified patch for that if needed. [1] http://stackoverflow.com/a/9116439/673826 [2] https://msdn.microsoft.com/en-us/library/8w5bsb4f.aspx
The patch is fine. Thanks. This code must have just been based on similar code in the gtk+ gtk-demo. However, I notice that the gtk-demo now bundles the source code and just uses g_resources_lookup_data(), avoiding the need for this reading of lines from files. We should do that too.
Calls to getc() were removed by this patch, obviously by mistake: https://git.gnome.org/browse/gtkmm/commit/?id=6ed01325449fec47457bee741f9c7ec04887c04e Surprising that it took almost 5 years before someone filed a bug report.
Review of attachment 302589 [details] [review]: I've pushed Mikhail's .diff file, rewritten as a git patch. https://git.gnome.org/browse/gtkmm/commit/?id=8b9d0145fc66d453f549d11a086023f85927d3ea The bug is fixed, but I leave it open until demowindow.cc has been updated like Murray suggests in comment 1.
Now gtkmm-demo uses a resource file with the source files and the images, just like gtk3-demo. https://git.gnome.org/browse/gtkmm/commit/?id=4936df66082eeefbc847e09187900d4f161441ff