GNOME Bugzilla – Bug 690641
sourceview: keep ref on SourceViewIO during call to input_stream_read_async().
Last modified: 2012-12-23 08:42:36 UTC
See attached patch.
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.
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.
(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?
(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.