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 690641 - sourceview: keep ref on SourceViewIO during call to input_stream_read_async().
sourceview: keep ref on SourceViewIO during call to input_stream_read_async().
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: editor: gtksourceview
unspecified
Other All
: Normal normal
: ---
Assigned To: Johannes Schmid
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2012-12-22 13:32 UTC by Carl-Anton Ingmarsson
Modified: 2012-12-23 08:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sourceview: keep ref on SourceViewIO during call to input_stream_read_async(). (2.75 KB, patch)
2012-12-22 13:32 UTC, Carl-Anton Ingmarsson
committed Details | Review

Description Carl-Anton Ingmarsson 2012-12-22 13:32:15 UTC
See attached patch.
Comment 1 Carl-Anton Ingmarsson 2012-12-22 13:32:16 UTC
Created attachment 232112 [details] [review]
sourceview: keep ref on SourceViewIO during call to input_stream_read_async().

Also disconnect signal handlers from SourceViewIO and cancel it before
releasing our reference to it in Sourceview.

This fixes warnings and segfaults when a Sourceview is destroyed before the
async call has finished.
Comment 2 Sébastien Granjoux 2012-12-22 20:37:33 UTC
Review of attachment 232112 [details] [review]:

I think it would be perhaps better to use an else instead of a goto. What do you think? If you agree, I can modify your patch directly.
Comment 3 Carl-Anton Ingmarsson 2012-12-22 22:12:18 UTC
(In reply to comment #2)
> Review of attachment 232112 [details] [review]:
> 
> I think it would be perhaps better to use an else instead of a goto. What do
> you think? If you agree, I can modify your patch directly.

Yeah, I agree that that's probably cleaner. Just keep in mind that that the g_object_unref() needs to be inside the "open-failed" case and inside the "open-finished" case.
Perhaps all the common code of the "open-failed" case and the "open-finished" should be put after the "done" goto instead?
Comment 4 Sébastien Granjoux 2012-12-23 08:42:22 UTC
(In reply to comment #3)
> Yeah, I agree that that's probably cleaner. Just keep in mind that that the
> g_object_unref() needs to be inside the "open-failed" case and inside the
> "open-finished" case.
> Perhaps all the common code of the "open-failed" case and the "open-finished"
> should be put after the "done" goto instead?

Yes, you are right, I have missed this common code. I have committed your patch after removing the goto and moving the common code at the end of the function. If you think that something is wrong reopen this bug and I will fix it.