GLibSharp / GtkSharp

.Net bindings for gtk+3 and above
Other
28 stars 21 forks source link

gapi3-codegen: Requires to support 'virtual' and 'override' modifiers #31

Open justinjoy opened 6 years ago

justinjoy commented 6 years ago

I found an issue while trying to fix a leakage[0] of gstreamer-sharp. The problem is that Gst.Element and Gst.Pipeline (which is a child of Gst.Element) has Bus property. Then, the code generator adds new modifier for Gst.Pipeline so an application has a redundant instance which is never unreffed.

https://github.com/GLibSharp/GtkSharp/blob/e29851eae80ee696ef6317f67ce53cdf74074420/Source/generator/Property.cs#L111

In the condition above, if a child class has the same property name with its parent, the code generator adds new modifier and it ignores new_flag attribute value even if it is set to false.

I think the generator should support virtual and override modifiers for parent and child respectively. Or, if there's nicer solution, please let me know.

[0] https://bugzilla.gnome.org/show_bug.cgi?id=793870

thiblahute commented 6 years ago

Virtual and override do not really make sense for method, the make sense for virtual methods though.

I think the current behaviour is correct, the thing is that in the GstElement VS GstPipeline case, the bus is the exact same (ie. the GstElement one) so we should hide the GstPipeline getter with an override.