Commit graph

44 commits

Author SHA1 Message Date
dmg
94ea7051f9 GException improvements with multithreading
Read all GError fields in GException constructor and free GError memory.

Quote from gtksharp2 fix: The original impl did not take into account exceptions marshalling across thread boundaries so it could end up with the error being accessed after being disposed.
2021-04-02 18:40:51 +02:00
Sergii Fesenko
9be7e092a8
Signal.Handler: correct flag check (#233) 2021-03-27 19:11:59 +01:00
Mads Kruse Johnsen
41d6f0bf28 Queue freeing of GCHandles instead of freeing them immidiately 2021-01-25 11:07:39 +01:00
Mads Kruse Johnsen
06b88bdbc5 Queue freeing of signals on the main-thread instead of on the Finalizer thread. 2021-01-25 11:07:39 +01:00
Mads Kruse Johnsen
7fb112727a Prevent double removal of timeout sources
See https://github.com/GLibSharp/GtkSharp/pull/49
2021-01-25 11:07:39 +01:00
Midhun Mohan
cd47acba85 Cleanup of sourceproxy Dictionary and its usages 2021-01-24 19:55:17 +01:00
Midhun Mohan
6af04a1058 Changing timeout_add and idle_add to _full. 2021-01-24 19:55:17 +01:00
Sebastian Dröge
89cfd16c10 Ensure to sink floating references passed unowned to GetObject() and to not increase their reference count
The API contract between GObject-Introspection and bindings is that
functions returning transfer-none floating references pass a reference
to the bindings that should be taken ownership of by sinking it. Not
doing so is wrong and will lead to memory leaks or double frees.

Previously we would not distinguish this case and simply increment the
reference count. In addition we would then sink the floating reference
when the Object.Raw field is set later for InitiallyUnowned subclasses.

Remove that last part and instead check directly in Object.Raw.set if we
get a floating reference and if so simply sink it here and take
ownership of it. The general assumption of Object.Raw.set is that it
gets passed a reference that it should take ownership of.

So in summary:
1) GetObject() would only increase the reference count of unowned,
   non-floating references so that we own it. For unowned, floating
   references it assumes ownership of the reference.
2) Raw.set assumes ownership of the reference passed to it and if it
   happens to be a floating reference then it will first sink it.

Also warn if we get a floating, owned reference passed to GetObject() as
that case is not allowed by GObject-Introspection and would cause the
reference to be leaked.

This fixes a memory leak with functions returning unowned, floating
references and with functions returning owned, non-floating references
of InitiallyUnowned subclasses. And at the same time keeps constructors
for InitiallyUnowned subclasses working correctly without leaks.

See https://gitlab.freedesktop.org/gstreamer/gstreamer-sharp/issues/31
2021-01-24 19:55:17 +01:00
Sebastian Dröge
5b63473a1c Use correct GType for GLib.InitiallyUnowned
It's not the same type as GLib.Object but a subclass thereof.
2021-01-24 19:55:17 +01:00
Thibault Saunier
1b9fe6a8ed Revert "Attempt minimal changes to obtain proper disposing."
This reverts commit 2e1882d31e.
2021-01-24 19:55:17 +01:00
Olivier Crête
a7d3e85829 ValueArray: Create copy when receiving pointer
The "ref" operation of GValueArray is a copy, so we don't have a
choice.
2021-01-24 19:55:17 +01:00
Thibault Saunier
dd8f3f994e glib: Handle GValue containing GType 2021-01-24 19:55:17 +01:00
Justin Kim
c980ef4f90 Object: Fix string leakages 2021-01-24 19:55:17 +01:00
Harry
724df41249
Revert "Sign the DLL files" 2020-08-07 13:30:09 +02:00
Harry
3b90cbf9f2
Merge pull request #139 from ermshiperete/sign
Sign the DLL files
2020-06-29 10:37:01 +02:00
Alex Dircksen
ed414df9f2 Handle NULL in GLib.Value -> GLib.Variant cast operator 2020-04-26 21:24:31 +02:00
lytico
c6cfc9d58c AbiStructExtension.BaseOverride: introduce an Extension to find the first overriden method in a base-class, even if a overriden class doesn't override the base class & change to GapiCodegen to use this extension 2020-04-06 22:31:10 +02:00
Mikkel Kruse Johnsen
ed68eeadfd
Sign the DLL files 2020-03-02 16:46:24 +01:00
cra0zy
e9f1f3628d Improve library loading code 2019-11-04 21:02:36 +01:00
Mikhail Kanygin
42a0e01775 Fixtures: added UnmanagedFunctionPointer to whole delegate calls collection to prevent stack incosistence exception for x86 apllications on windows. 2019-11-04 20:12:50 +01:00
cra0zy
377a1abfc4 Revert "Project files"
This reverts commit 32fdca5754.
2019-08-10 17:02:18 +02:00
Mads Kruse Johnsen
99960543b1 Null check 2019-08-10 15:58:34 +02:00
Mads Kruse Johnsen
2e1882d31e Attempt minimal changes to obtain proper disposing. 2019-08-10 15:58:34 +02:00
Mads Kruse Johnsen
32fdca5754 Project files 2019-08-10 15:58:34 +02:00
Mikkel Kruse Johnsen
9764260931 Free all internal signals, else the garbage collector is not able to free the object. 2019-01-08 11:39:25 +01:00
miegir
93deaa1219
fix type initialization error in VariantType
Move public static fields below function pointers on which they depend
2018-11-05 22:42:54 +03:00
Harry
553b59abb8
Revert "Fix a null reference exception" 2018-03-01 17:02:25 +01:00
cra0zy
186b1ce72b Fix a null reference exception 2018-03-01 15:04:08 +01:00
cra0zy
26ef5bad3e
Fix file permissions, how did this happen? 2018-02-26 23:03:31 +01:00
cra0zy
7952f969cf Remove unused info from GLib api file 2018-01-22 02:45:30 +01:00
cra0zy
411cdfd502 Safeload static functions as well 2018-01-18 22:54:45 +01:00
cra0zy
3f0810c93a Split out FuncLoader into multiple files 2018-01-18 20:41:31 +01:00
cra0zy
543a29569b Replace DllImport with a better multiplatform solution 2018-01-18 20:41:03 +01:00
cra0zy
c17b5051bd Fix SimpleAction events 2017-12-23 02:58:41 +01:00
cra0zy
a09f751b10 Generate .dll.config files for standard .NET projects 2017-11-11 19:11:44 +01:00
cra0zy
ee57c26d77 Improve native lib referencing 2017-11-09 22:22:51 +01:00
cra0zy
c6060b93a6 Fixup the links to point to the organization 2017-10-30 20:41:26 +01:00
cra0zy
4bc1fb5101 Add .dll to the name of the libs because on Windows .Net Core does not try to guess the name 2017-10-30 00:49:23 +01:00
cra0zy
ac7ea69ce8 Fix linux stubs linking 2017-10-30 00:23:56 +01:00
cra0zy
cfc794c3bd Add arm linux stubs 2017-10-29 16:46:34 +01:00
cra0zy
32bf88c341 Add package and assembly info 2017-10-29 15:28:44 +01:00
cra0zy
ccb48b505c EnablAdd auto generation of native lib stubs 2017-10-26 18:30:48 +02:00
cra0zy
46951b3f91 NuGet packaging, Dll mapping and general .Net core improvements 2017-10-26 01:42:57 +02:00
cra0zy
6926c9cbf2 WIP CAKE + .Net Core 2017-10-23 01:25:13 +02:00