Skip to content

[Mousepad 0.5] Adjust an idle priority so that it runs before closure

Gaël Bonithon requested to merge Tamaranch/mousepad:adjust-idle-priority into master

To fix #26 (closed), an idle was added to scroll to cursor after some GTK operations. It appears that it can have side effects when closing the window just after a search in a sufficiently big file (I did my tests with a 14 000 lines html file, searching for < via the replace dialog, with "Replace all in document" checked). The scrolling operation is too delayed and takes place when there is no more textview/document/window.

I found that G_PRIORITY_HIGH_IDLE + 20 is a good priority to preserve the benefit of delaying the operation without adding side effects. More precisely, G_PRIORITY_HIGH_IDLE + 19 doesn't add side effects but doesn't fix #26 (closed) either, whereas G_PRIORITY_HIGH_IDLE + 30 fixes #26 (closed) but adds side effects. So I took the interval lower bound (as far as possible from side effects).

To be more secure, I added also a series of tests before the scrolling operation, to ensure that all objects exist.

Merge request reports

Loading