ddobrev / QtSharp

Mono/.NET bindings for Qt
Other
571 stars 52 forks source link

System.InvalidOperationException in GetSignalEventSuffix #23

Closed durswd closed 9 years ago

durswd commented 9 years ago

System.InvalidOperationException is caused in GetSignalEventSuffix when signalToUse.Parameters.Count is 0.

GetSignalEventSuffix is called in GenerateSignalEvents, even if @event.Parameters.Count is 0.

ddobrev commented 9 years ago

Do you use Qt 5.3.2? Clang has a problem with it which results in the bug you see. If possible, upgrade to Qt 5.4 where the problem is gone. If not, let me know.

durswd commented 9 years ago

Thank you. This problem was solved. But I think " existing.Name += GetSignalEventSuffix(@event);" is wrong in GenerateSignalEventsPass.cs(Line75)

This line is invariably throw an exception because this line is executed when @event.Parameters.Count is 0 even if GetSignalEventSuffix requires @event.Parameters.Last().

Shold this line be removed or insert an assert?

ddobrev commented 9 years ago

@durswd I am sorry but I could not get for sure: does upgrading to Qt 5.4 solve the problem for you or not? About the line, it is correct. Let me tell you what the exact problem is. Clang, with Qt 5.3.2. and for certain headers such as qiodevice.h, gets the wrong source locations and reports non-signal members as having the Q_SIGNAL macro. The error you get is because of d_func(). That is not a signal but it gets to the point of the crash nevertheless. This is exactly because Clang has incorrectly attached the Q_SIGNAL macro to it. It does the same for any other function, such as readData(), that is located below, but outside, the section for signals of the class (QIODevice) in question.

durswd commented 9 years ago

Sorry. I have upgraded to Qt 5.4 and solved it.