Skip to content

Commit

Permalink
Merge pull request #529 from gircore/fix/boxed_record_construction
Browse files Browse the repository at this point in the history
Fix creation of boxed records
  • Loading branch information
badcel authored Jan 21, 2022
2 parents 187f691 + a8ecbef commit 395bf92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class PublicClassModel

public string Name => _record.GetPublicClassName();
public string InternalHandleName => _record.GetInternalHandleName();
public string InternalOwnedHandleName => _record.GetInternalOwnedHandleName();
public string InternalUnownedHandleName => _record.GetInternalUnownedHandleName();
public string NamespaceName => _record.Namespace.Name;

public PublicClassModel(GirModel.Record record)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public partial class {model.Name} : GLib.IHandle
Initialize();
}}
//TODO: This is a workaround constructor as long as we are
//not having https://github.com/gircore/gir.core/issues/397
private {model.Name}(IntPtr ptr, bool ownsHandle) : this(ownsHandle
? new Internal.{model.InternalOwnedHandleName}(ptr)
: new Internal.{model.InternalUnownedHandleName}(ptr)){{ }}
// TODO: Default Constructor (allocate in managed memory and free on Dispose?)
// We need to be able to create instances of records with full access to
// fields, e.g. Gdk.Rectangle, Gtk.TreeIter, etc.
Expand Down

0 comments on commit 395bf92

Please sign in to comment.