GNOME Bugzilla – Bug 694687
Introspection: Crash on "sync-source" signal
Last modified: 2018-04-09 13:53:50 UTC
Created attachment 237366 [details] [review] Patch: Change type of argument for the sync-source signal Using GObject introspection and trying to catch the "sync-source" signal to get SyncTex working results in a nasty crash with the error message: ** (document_window.py:25229): CRITICAL **: Converting of type 'void' is not implemented ** ERROR:pygi-argument.c:2111:_pygi_argument_from_g_value: code should not be reached After consulting with people at #introspection the problem was found to be the signal specification of sync-source. Since the argument was a void pointer, it was not introspectable. Changing the type of the signal argument to EvSourceLink makes the introspected code work as intended (no crash!). Patch that fixes the problem is attached. Looking at the documentation, my guess is that the "popup" signal suffers from the same problem, but I have not tested it.
Yes, the "popup" signal has a similar problem. Not sure how to solve that though, since it gets a GList with items of many different types without a common base type...
But the fix for sync-source could be applied anyway, I hope.
Review of attachment 237366 [details] [review]: It totally makes sense to me.
Review of attachment 237366 [details] [review]: Thanks, I have a couple of comments, though. ::: libview/ev-view.c @@ +4871,3 @@ G_STRUCT_OFFSET (EvViewClass, sync_source), NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, This is not correct, because EvSourceLink is not an object, but a boxed type, it should be g_cclosure_marshal_VOID__BOXED. @@ +4874,2 @@ G_TYPE_NONE, 1, + EV_TYPE_SOURCE_LINK); We could use G_SIGNAL_TYPE_STATIC_SCOPE flag for this parameter to avoid copies of the boxed type during the signal emission.
@reporter: can you please update the patch as comment 4 says? Thx!
Created attachment 274395 [details] Test code It is minimalist code to test the bug
I see that the patch has never been applied and the bug is still present. I'm trying to use this signal from python and it doesn't work. It does not produce a nasty crash any more, but the signal parameters are useless. More precisely, the parameter which should be a SourceLink is actually passed as an integer in the current code. I believe this integer value is transformed from a c pointer somehow. In Python it is just a meaningless integer. It's quite frustrating because I can't find any way around this from python and my code reached a dead end. I made this code which is a minimalist example to test the signal, which is attached to the previous comment.
Luis, thanks for the testcase. I had forgotten about this bug, I am sorry. I should test the patch soon so we can integrate it.
Thanks Jose. I'm trying to make a LaTeX editor with Python+GTK and without backwards search it is worthless.
Created attachment 361016 [details] [review] libview: Make sync-source signal introspectable Addresses Carlos' comments.
Comment on attachment 361016 [details] [review] libview: Make sync-source signal introspectable LGTM, thanks
The following fix has been pushed: 8dbd0c6 libview: Make sync-source signal introspectable
Created attachment 370693 [details] [review] libview: Make sync-source signal introspectable