Assuming GtkRecentAction implementation in GTK is a good inspiration, we 
don't actually need to delay signal connection to `connect_proxy()`: it 
only allows to connect proxies we didn't create ourselves, and we don't 
actually *want* to connect those.

Doing it in `connect_proxy()` the way we did actually creates an issue: foreign 
proxies can be created (e.g. menu items in the toolbar overflow menu), and for 
those we must not re-connect on the entry, otherwise we would duplicate signal 
connections, leading to odd behavior.

As we don't need to actually connect signals on foreign proxies, we can 
simply connect them when creating our own entry.  This has a couple benefits:

* We don't risk connecting twice, as we only connect on fresh entries, 
never on previously existing ones.
* We don't use a cached entry inside the action, which makes creating more 
than one tool item for the same action a lot more robust, as the action 
don't keep track of *any* entry anymore, instead of tracking only the one 
created last.

Fixes #4012.
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/4313

-- Commit Summary --

  * geanyentryaction: Fix duplicate signals and simplify code

-- File Changes --

    M src/geanyentryaction.c (73)

-- Patch Links --

https://github.com/geany/geany/pull/4313.patch
https://github.com/geany/geany/pull/4313.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4313
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/[email protected]>

Reply via email to