<table><tr><td style="">kossebau added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D22424">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D22424#497316" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: line-through;">D22424#497316</a>, <a href="https://phabricator.kde.org/p/rjvbb/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@rjvbb</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>Since we're dealing with "please read/see again": idem for my comment :P which only states that a single QMenu instance is being (re)used. I've never seen it change</p></div>
</blockquote>
<p>Please add a line</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">qDebug() << "Showing context menu" << menu;</pre></div>
<p>to KDevelop::TextDocument::populateContextMenu.</p>
<p>Rebuild & install, then run kdevelop, disable the CTags plugin, have 2 text documents open:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">invoke context menu a few times on view of document A -> same menu instance CM_A</li>
<li class="remarkup-list-item">switch to view of document B, invoke context menu a few times -> same menu instance CM_B (!= CM_A)</li>
<li class="remarkup-list-item">switch back to view of document A, invoke context menu a few times -> same menu instance CM_A2 (!=, CM_A, != CM_B)</li>
</ol>
<p>This is behaviour I pbserved here consistently with KF 5.60.</p>
<p>When enabling the CTags plugin again, suddenly it is always the same menu instance.</p>
<p>If we consider that every time a document is switched, that this internally triggers a remerge of all the menus defined by the kxmlguiclients, due to the xmlgui menu data from the old view being removed and the xmlgui menu data from the new view being added, it is actually not that surprising (well, once one has thought a lot about it :P ) that the context menu object is recreated. Because without any other kxmlgui client injecting a menu of id "ktexteditor_popup" into the system (like the ctags plugin does), when a texteditor view is removed from the shell kxmlgui, nothing else demands/defines a menu with that id, so it gets deleted. And then recreated, because the new view getting active and adding its kxmlgui data has again such a menu defined with that id.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22424">https://phabricator.kde.org/D22424</a></div></div><br /><div><strong>To: </strong>kossebau, KDevelop<br /><strong>Cc: </strong>anthonyfieroni, rjvbb, kdevelop-devel, hmitonneau, christiant, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>