Skip to content

gmem: Only evaluate pointer argument to g_clear_pointer() once

The new typeof() macro version of g_clear_pointer() was evaluating its pointer argument more than once, meaning any side effects would be evaluated multiple times.

The existing (other) macro version of g_clear_pointer() was evaluating its argument exactly once. This mismatch could have confused people or lead to subtle bugs.

See #1494 (closed).

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


Ideally this should go into 2.58 before the new g_clear_pointer() version makes it into a stable release.

Merge request reports