<table><tr><td style="">kossebau edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-j3i6q62fg3ehhw4/">(Show Details)</a>
</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><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">C</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Fixes a bug of context menu entries being duplicated each time the context<br />
menu is shown with another document in same cases.<br />
This happened, as each document instance tracks what actions it adds to a<br />
context menu, but only removes the actions once the menu is shown again.<br />
Which fails if the menu is shown with another document than before, but the<br />
same context menu object is reused again, thus still having the actions from<br />
the other document.<br />
<br />
Small recap, as the situation is a bit complex:<br />
<br />
A c</span>ontext menu in KDevelop text documents is <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">shown</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">triggered</span> by th<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">e</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">e method</span><br />
KateViewInternal::contextMenuEvent<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">()</span>, where KateViewInternal is an internal<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">w</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">QW</span>idget class of<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> the actual</span> KTextEditor::View<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> implmenetation</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Private, which is the</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">actual </span>KTextEditor::View<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">Private</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> implementation</span>. <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">The</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">That</span> KateViewInternal <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">code</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">method</span> asks its<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> container</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">container </span>KTextEditor::ViewPrivate for the contextMenu() and calls popup() on it.<div style="padding: 8px 0;">...</div>More, even per view one gets a new QMenu object every<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"> </span>time the view becomes the<br />
active one again (and thus merging into the app <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">xmlgui</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">XMLGUI</span> structure is done).<br />
Due to this the duplicated entries in the context menu <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">is</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">are</span> currently only<div style="padding: 8px 0;">...</div>shown again. Sadly the commit message does not explain where <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">exaxtly</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">exactly</span><br />
things failed, and just described the symptom: "don't trust Qt's aboutToHide<div style="padding: 8px 0;">...</div>relation is not immediat<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">e</span>ly obvious, as there should be little chance that<div style="padding: 8px 0;">...</div></div></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>