1. 27 Dec, 2018 1 commit
  2. 20 Dec, 2018 1 commit
    • Kouhei Sutou's avatar
      Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++ · b8ac6e14
      Kouhei Sutou authored
      Note that it's not reported with gcc. It's only reported with g++.
      
      C++ code to reproduce this warning:
      
          #include <glib-object.h>
      
          G_BEGIN_DECLS
      
          #define GARROW_TYPE_FILE (garrow_file_get_type())
          G_DECLARE_INTERFACE(GArrowFile,
                              garrow_file,
                              GARROW,
                              FILE,
                              GObject)
      
          struct _GArrowFileInterface {
            GTypeInterface g_iface;
          };
      
          G_DEFINE_INTERFACE(GArrowFile,
                             garrow_file,
                             G_TYPE_OBJECT)
      
          static void
          garrow_file_default_init(GArrowFileInterface *iface)
          {
          }
      
          G_END_DECLS
      
      Build command line:
      
          % g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)
      
      Message:
      
          In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
                           from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
                           from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
                           from a.cpp:1:
          a.cpp: In function 'GType garrow_file_get_type()':
          /tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
           #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          /tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
                 if (TYPE_PREREQ) \
                     ^~~~~~~~~~~
          /tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
           #define G_DEFINE_INTERFACE(TN, t_n, T_P)      G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
           G_DEFINE_INTERFACE(GArrowFile,
           ^~~~~~~~~~~~~~~~~~
          /tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
           #define G_TYPE_OBJECT   G_TYPE_MAKE_FUNDAMENTAL (20)
                                   ^~~~~~~~~~~~~~~~~~~~~~~
          a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
                              G_TYPE_OBJECT)
                              ^~~~~~~~~~~~~
      b8ac6e14
  3. 17 Dec, 2018 1 commit
    • Benjamin Berg's avatar
      binding: Clarify the use of g_object_unref() to remove a binding · f5e1e169
      Benjamin Berg authored
      Conceptually the binding is kept alive as long as both the source and
      target exist. This means that an API user needs to take some care to
      either hold a reference or only use a pointer to the binding as long as
      also holding references to both objects.
      
      Clarify the documentation a bit.
      f5e1e169
  4. 12 Dec, 2018 3 commits
  5. 10 Dec, 2018 2 commits
  6. 05 Dec, 2018 1 commit
  7. 04 Dec, 2018 1 commit
  8. 25 Nov, 2018 2 commits
  9. 15 Nov, 2018 1 commit
    • Marco Trevisan's avatar
      gobject, tests: add tests for autoptr (and lists) with declared · 8d42b024
      Marco Trevisan authored
      Add tests using an object declared with G_DECLARE_FINAL_TYPE, that is derived
      from another, declared using G_DECLARE_DERIVABLE_TYPE, and that
      thus uses _GLIB_DEFINE_AUTOPTR_CHAINUP to define cleanup functions.
      
      And verify that both g_autoptr(Type) and g_auto(s)list(Type) work
      8d42b024
  10. 01 Nov, 2018 1 commit
  11. 31 Oct, 2018 2 commits
  12. 22 Oct, 2018 1 commit
  13. 15 Oct, 2018 1 commit
  14. 10 Oct, 2018 1 commit
  15. 25 Sep, 2018 1 commit
  16. 24 Sep, 2018 1 commit
  17. 23 Sep, 2018 1 commit
  18. 04 Sep, 2018 1 commit
  19. 16 Aug, 2018 3 commits
    • Philip Withnall's avatar
    • Philip Withnall's avatar
      gclosure: Clarify when destroy notifiers are called in documentation · 5b7c109e
      Philip Withnall authored
      They’re called in finalize, not invalidate.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      
      #277
      5b7c109e
    • Christoph Reiter's avatar
      g_binding_unbind: make it more introspection friendly; allow calling it multiple times. Fixes #1373 · 0319dac0
      Christoph Reiter authored
      g_object_bind_property() (transfer none) returns a GBinding with an existing internal
      reference which is active as long as the "binding" is. This allows to optionally use
      the binding without any memory management, as it will remove itself when it is no longer
      needed.
      
      There are currently three ways to remove the "binding" and as a result the reference:
      
      1) Either the source or target dies and we get notified by a weakref callback
      2) The user unrefs the binding until it is destroyed (which is semi-legal,
         but worked and is used in the test suite)
      3) The user calls g_binding_unbind()
      
      In case (3) the problem was that it always calls unref even if the "binding" is already
      gone, leading to crashes when called from bindings multiple times.
      In #1373 and !197 it was noticed that a function always unrefs which would be a
      "transfer full" annotation, but the problem here is that it should only remove the
      ref when removing the "binding" and the annotation should stay "transfer none".
      
      As a side effect of this fix it is now also possible to call g_binding_unbind() multiple
      times where every call after the first is a no-op.
      
      This also adds explicit tests for case (1) and (3) - only case (3) is affected by this change.
      0319dac0
  20. 15 Aug, 2018 1 commit
  21. 10 Aug, 2018 4 commits
  22. 30 Jul, 2018 1 commit
  23. 25 Jul, 2018 1 commit
  24. 19 Jul, 2018 2 commits
    • Christoph Reiter's avatar
      meson: use the new 'python' module instead of the 'python3' one. Closes #1455 · 631c3534
      Christoph Reiter authored
      The new python module, added with 0.46, works with Python 2 and 3 and
      allows to pass a path for the interpreter to use, if the need arises.
      
      Previously the meson build set PYTHON, used in the shebang line of
      the scripts installed by glib, to the full path of the interpreter.
      The new meson module doesn't expose that atm, but we should set it to
      a executable name anyway, and not a full path.
      631c3534
    • Nirbheek Chauhan's avatar
      meson: Provide our Python tools for builds · 057f393b
      Nirbheek Chauhan authored
      Several of our tools are installed and are used by other projects to
      generate code. However, there is no 'install' when projects use glib
      as a subproject.
      
      We need some way for glib to 'provide' these tools so that when some
      project uses glib as a subproject, find_program('glib-mkenums') will
      transparently return the glib-mkenums we just built.
      
      Starting from Meson 0.46, this can be done with the
      `meson.override_find_program()` function.
      
      As a bonus, the Meson GNOME module will also use these
      'overriden'/'provided' programs instead of looking for them in PATH.
      057f393b
  25. 16 Jul, 2018 2 commits
  26. 12 Jul, 2018 2 commits
    • Thomas H.P. Andersen's avatar
      python: avoid equality check for None · a8b416f9
      Thomas H.P. Andersen authored
      PEP8 says that:
      "Comparisons to singletons like None should always be done with is or
      is not, never the equality operators."
      
      glib uses a mix of "== None" and "is None". This patch changes all
      cases to the latter.
      a8b416f9
    • Iain Lane's avatar
      gobject: Make g_clear_object take a non-volatile GObject ** · 2aacef39
      Iain Lane authored
      The implementation is silently discarding this anyway, and
      g_object_unref() is using atomic operations. So this should be safe.
      
      Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer()
      is fixed to use __typeof__().
      2aacef39
  27. 11 Jul, 2018 1 commit