[Vala] Calling to a non-static member of a null object




Just wanted to share with you some weird thing in Vala.
I'll give an example to what I said in the title:
This code return access to method denied:
MainContext.iteration (null, false)
See GLib docs[1]. You can pass null and it means the default main loop context.
But how can we perform method for null?
So, you need to cast null to (MainContext?). It looks like that:
((MainContext?)null).iteration (false)

Don't know if you threat this as an bug in architecture or not, just want to share it.

[1] http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-main-context-iteration
                                          


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]