Commit Graph

7 Commits

Author SHA1 Message Date
Ville Skyttä
b20647c2e2 docs: spelling and grammar fixes
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2024-04-01 11:01:06 +00:00
Philip Withnall
e59e8ebf31 gwin32networkmonitor: Fix returning address of local variable
Something has changed recently which causes this error to now be emitted
when building on Windows msys2-mingw32:
```
../gio/gwin32networkmonitor.c: In function 'win_network_monitor_get_ip_info':
../gio/gwin32networkmonitor.c:92:15: error: storing the address of local variable 'prefix' in '*dest' [-Werror=dangling-pointer=]
   92 |         *dest = (guint8 *) &prefix.Prefix.Ipv4.sin_addr;
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

If `IP_ADDRESS_PREFIX` is defined as a scalar rather than a pointer,
that could explain the problem.

Change the function to always operate on a pointer to avoid any
potential such issues.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-09 12:52:42 +01:00
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Milan Crha
ca0add4b8a gnetworkmonitor: Fix use-after-free when using from another thread
When using g_network_monitor_get_default() from another thread, it’s
possible for network-changed events to be processed after an instance of
GNetworkMonitor has been disposed, causing use-after-free problems.

Fix that by moving some of the initialisation into the GInitable.init()
chain, rather than in a main context idle callback.

This includes a unit test which probabilistically reproduces the bug
(but can’t do so deterministically due to it being a race condition).

Commit amended by Philip Withnall <withnall@endlessm.com> before
pushing.

https://bugzilla.gnome.org/show_bug.cgi?id=793727
2018-04-11 15:03:43 +01:00
Tim-Philipp Müller
03d06c175f gwin32networkmonitor: fix build with MSVC
Don't include unistd.h unconditionally.
2018-02-20 00:56:35 +00:00
Philip Withnall
3787e42932 gio: Rename GNetworkMonitorWindows to GWin32NetworkMonitor
This makes it more consistent with other GWin32* objects. No functional
changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=685442
2018-01-18 10:12:26 +00:00
Philip Withnall
ba976f13b6 gio: Rename gnetworkmonitorwindows to gwin32networkmonitor
This makes it more consistent with the other win32 objects in GIO. This
commit just renames the files; a follow-up commit will rename the
GObject.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=685442
2018-01-17 12:59:51 +00:00