Skip to content

WIP: web-source: avoid connecting a signal multiple times

Amaury Pouly requested to merge pamaury/geoclue:signalfix into master

gclue_web_source_set_submit_source can be called many times with the same web source and location source. If a client keeps connecting and disconnecting, this will essentially create one more closure and connect one extra signal on every connect. After a few hours, one can have the same signal connected thousands of times between the same pair of objects. Since those objects are essentially singleton, they never go away and the memory usage, because of the closures, will increase over time. On top of that, it means that on every location change, the code will notify the same object thousands of time, which is extremely inefficient.

I have tested this code on my computer and it seems to work as expected but I admit I am not familiar enough with GObject to be 100% sure that's the proper way to fix this. I am also unsure why gclue_web_source_set_submit_source is called so many times. I put WIP in the title to make sure that this commit is really double-checked before being accepted.

Merge request reports