After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694687 - Introspection: Crash on "sync-source" signal
Introspection: Crash on "sync-source" signal
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.6.x
Other Linux
: High major
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-02-25 16:28 UTC by Hannes Ovrén
Modified: 2018-04-09 13:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch: Change type of argument for the sync-source signal (646 bytes, patch)
2013-02-25 16:28 UTC, Hannes Ovrén
needs-work Details | Review
Test code (765 bytes, text/x-python)
2014-04-15 19:37 UTC, Luis
  Details
libview: Make sync-source signal introspectable (1.03 KB, patch)
2017-10-06 02:10 UTC, Germán Poo-Caamaño
committed Details | Review
libview: Make sync-source signal introspectable (1.03 KB, patch)
2018-04-09 13:53 UTC, Germán Poo-Caamaño
committed Details | Review

Description Hannes Ovrén 2013-02-25 16:28:18 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.
Comment 1 Christian Persch 2013-02-25 17:02:16 UTC
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...
Comment 2 Hannes Ovrén 2013-02-25 20:35:09 UTC
But the fix for sync-source could be applied anyway, I hope.
Comment 3 José Aliste 2013-02-25 22:45:09 UTC
Review of attachment 237366 [details] [review]:

It totally makes sense to me.
Comment 4 Carlos Garcia Campos 2013-02-28 18:48:05 UTC
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.
Comment 5 Christian Persch 2013-06-09 21:27:19 UTC
@reporter: can you please update the patch as comment 4 says? Thx!
Comment 6 Luis 2014-04-15 19:37:43 UTC
Created attachment 274395 [details]
Test code

It is minimalist code to test the bug
Comment 7 Luis 2014-04-15 19:39:31 UTC
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.
Comment 8 José Aliste 2014-04-15 21:01:55 UTC
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.
Comment 9 Luis 2014-04-29 21:55:27 UTC
Thanks Jose. I'm trying to make a LaTeX editor with Python+GTK and without backwards search it is worthless.
Comment 10 Germán Poo-Caamaño 2017-10-06 02:10:06 UTC
Created attachment 361016 [details] [review]
libview: Make sync-source signal introspectable

Addresses Carlos' comments.
Comment 11 Carlos Garcia Campos 2017-11-18 08:06:35 UTC
Comment on attachment 361016 [details] [review]
libview: Make sync-source signal introspectable

LGTM, thanks
Comment 12 Germán Poo-Caamaño 2018-04-09 13:53:41 UTC
The following fix has been pushed:
8dbd0c6 libview: Make sync-source signal introspectable
Comment 13 Germán Poo-Caamaño 2018-04-09 13:53:50 UTC
Created attachment 370693 [details] [review]
libview: Make sync-source signal introspectable