After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748657 - Missing getc_unlocked for demowindow.cc on Windows
Missing getc_unlocked for demowindow.cc on Windows
Status: RESOLVED FIXED
Product: gtkmm
Classification: Bindings
Component: general
3.16.x
Other Windows
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2015-04-29 16:37 UTC by Mikhail Titov
Modified: 2015-05-13 13:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use getc if HAVE_GETC_UNLOCKED is not defined (550 bytes, patch)
2015-04-29 16:37 UTC, Mikhail Titov
committed Details | Review

Description Mikhail Titov 2015-04-29 16:37:20 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
Comment 1 Murray Cumming 2015-04-30 11:24:10 UTC
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.
Comment 2 Kjell Ahlstedt 2015-05-05 10:02:27 UTC
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.
Comment 3 Kjell Ahlstedt 2015-05-06 17:32:19 UTC
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.
Comment 4 Kjell Ahlstedt 2015-05-13 13:34:12 UTC
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