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 751345 - [PATCH] Using tab group cause plugin add another copy of entry to the menu
[PATCH] Using tab group cause plugin add another copy of entry to the menu
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-22 20:32 UTC by asl97
Modified: 2019-03-23 20:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix popup item duplication.patch (2.04 KB, patch)
2017-03-22 12:37 UTC, asl97
none Details | Review
Fix popup item duplication (2.49 KB, patch)
2017-06-17 13:57 UTC, asl97
none Details | Review

Description asl97 2015-06-22 20:32:45 UTC
irc log: 2015.05.30
____
[03:52:13] asl97: does anyone know if the bug where using tab group cause plugin like join/split line and code comment to add another copy of entry to the menu has been fix?
[03:52:41] asl97: image is set to be deleted in an hour, i can reupload it if needed: [image been deleted long ago]
[03:57:55] gregier: asl97: not fixed
[03:59:18] gregier: and afaik it is a new bug, we probably don't use the context menu that much so it just went unnoticed 
[04:02:05] gregier: although it looks like it must be a gedit/gsv/gtk+ issue
[04:07:00] asl97: i use the context menu quite a bit but this is the first time i saw it cause i accidentally click the left mouse button then the right only to see the group tab. i played with it and before i know it, the menu became long
[04:07:16] gregier: yeah very weird, the plugins just connect to a signal and add menu items
[04:07:41] gregier: so I'm guessing that the signal is being called multiple times for some reason 
[04:22:22] gregier: freaky! left tab group has 2x, right tab group has 3x
[07:35:26] asl97:  gregier: should i file the bug or will you be filing it?
[13:56:29] gregier: asl97: best if you file it
Comment 1 asl97 2017-03-22 12:37:50 UTC
Created attachment 348479 [details] [review]
Fix popup item duplication.patch
Comment 2 asl97 2017-03-22 12:45:50 UTC
The bug affect the joinlines and codecomment plugin

When enabling it, it add an handler to the `populate-popup`.
But disabling it doesn't remove it.

So when disabling and re-enabling it, an additional handler is added causing the duplication.

Splitting the view seem to trigger the activate causing more additional handle to be added, resulting in different number of handler in each view, causing the `left tab group has 2x, right tab group has 3x`.

see patch for fix.
Comment 3 Sébastien Wilmet 2017-04-06 09:12:51 UTC
Review of attachment 348479 [details] [review]:

Looks good, but to have more robust code, the signal should be disconnected only if self.popup_handler_id != 0 (and then set it to 0). The class constructor should probably initialize self.popup_handler_id to 0, otherwise the instance variable doesn't always exist.

Normally do_deactivate is called only once, and always after do_activate, but it's anyway safer to have more robust code, just in case.
Comment 4 asl97 2017-06-17 13:57:38 UTC
Created attachment 353942 [details] [review]
Fix popup item duplication
Comment 5 asl97 2017-06-17 14:01:01 UTC
Meh, it's stupid how something like this is stalling the bugfix.

IMO, those ain't needed but since I ain't gonna be maintaining it and it's ain't my code base, let's just do it your way and get this over with.
Comment 6 Jeremy Bicha 2018-01-28 22:31:24 UTC
Thank you for helping to make gedit better. I adjusted the commit message and pushed for you.