tiny fix for gobject var proc parameters which may be nil

This commit is contained in:
Stefan Salewski 2021-10-01 11:01:00 +02:00
commit eba4a984dd
3 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,6 @@
= High level GTK4 and GTK3 bindings for the Nim programming language
//(c) Stefan Salewski
//Version 0.9.3
//Version 0.9.5
:experimental:
:imagesdir: http://ssalewski.de/tmp
//:source-highlighter: pygments
@ -29,7 +29,11 @@ with code inserted from files directly.
NOTE: This work is partly based on earlier works of J. Mansour and has been supported by A. Rumpf, E. Bassi and other _Nim_ and _GTK/Gnome_ developers.
The `combinatorics` module was kindly provided by R. Behrends.
NOTE: This is version 0.9.4 of the gintro Nim GTK bindings. This version contains a lot of fixes.
NOTE: This is version 0.9.5 of the gintro Nim GTK bindings. We added a patch to support very old GTK3 versions
like Debian Buster, updated the list of "light symbols" like Rectangle, TextIter and such that do not
need Nim Proxy objects, and finally fixed a recent glib proc name conflict.
NOTE: Version 0.9.4 of the gintro Nim GTK bindings contains a lot of fixes.
Before 0.9.4 some GtkDrawingArea examples gave crashes with the most recent Nim compiler
due to a wrong cast from ref object to RootRef. That is fixed, and the drawingarea example works now
also without manually freeing cairo resources like Context, Surface and Pattern. We have not updated the example,

View file

@ -1,6 +1,6 @@
# Package
version = "0.9.4"
version = "0.9.5"
author = "Stefan Salewski"
description = "High level GObject-Introspection based GTK4/GTK3 bindings"
license = "MIT"

View file

@ -1,6 +1,6 @@
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim
# v 0.9.5 2021-SEP-29
# v 0.9.5 2021-OCT-01
# (c) S. Salewski 2018, 2019, 2020, 2021
# usefull for finding death code:
@ -1322,7 +1322,7 @@ proc genPars(info: GICallableInfo; genProxy = false; binfo: GIBaseInfo = nil; ge
else:
if isGobject:
if gArgInfoIsOptional(arg):
result.arglist.add("cast[var " & ngr.name00 & "](if addr(" & name & ") == nil: nil else: tmpoutgobjectarg)")
result.arglist.add("cast[var " & ngr.name00 & "](if addr(" & name & ") == nil: nil else: addr tmpoutgobjectarg)")
else:
result.arglist.add("tmpoutgobjectarg")
result.tmpoutgobjectarg = " var tmpoutgobjectarg: " & ngr.name00 & "\n"
@ -3309,12 +3309,12 @@ const GObject_EPI = """
# let p = cast[ptr cuint](cast[int](o.impl) + sizeof(pointer))
# return p[].int
proc scNotify*(self: Object; p: proc (self: ptr Object00; paramSpec: ptr ParamSpec00; xdata: pointer) {.cdecl.}, xdata: pointer, cf: gobject.ConnectFlags; sigName: cstring): culong =
# g_signal_connect_data(self.impl, "notify::cursor-position", cast[GCallback](p), xdata, nil, cf)
g_signal_connect_data(self.impl, sigName, cast[GCallback](p), xdata, nil, cf)
proc typeCheckInstanceIsA*(instance: Object; ifaceType: GType): bool =
toBool(g_type_check_instance_is_a(cast[ptr TypeInstance00](instance.impl), ifaceType))
# similar to gobjectTemp()
proc glistObjects2seq*[T](t: typedesc[T]; l: ptr glib.List; elTransferFull: bool): seq[T] =