Skip to content
Discussion options

You must be logged in to vote

This is actually some kind of bug in GirCore. PtrArray is a record from GObject perspective. I assumed that records can just be created manually in memory. Which is at least not true for PtrArray as it requires some specific initialization.

Unfortunately there is not even the New function be generated which would do this for you.

A workaround for now is to call the new method manually:

using System.Runtime.InteropServices;

Console.WriteLine("Hello, World!");

GLib.Module.Initialize();

while (true)
{
    var handle = new GLib.Internal.PtrArrayOwnedHandle(New());
    using var arr = new GLib.PtrArray(handle);
    Thread.Sleep(100);
}

[DllImport("libgobject-2.0.so.0", EntryPoint = "g_ptr_…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@alansartorio
Comment options

Answer selected by badcel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants