<p>The changes seem to achieve the correct results (looking at them, not yet tested), but the function looks already terribly fragile and weird (i.e., what if one of the expected answers was <code>CANCEL</code> already?).  The odd code here was mapping <code>"Cancel"</code> label to <code>RESPONSE_CANCEL</code>, and back <code>RESPONSE_CANCEL</code> to whatever response was associated with the <code>"Cancel"</code> label.  Meh.  As you say, discarding the dialog emits <code>RESPONSE_DELETE_EVENT</code>, not <code>CANCEL</code>, so it was effectively useless.  Also, knowing the dialog was canceled might be a valuable information to the caller, and it could be handled differently than <code>response_2</code> (and why choose <code>response_2</code> in the first place?  it doesn't have any semantic to it).</p>

<p>Also, it would probably be more solid to <code>return ret != GTK_RESPONSE_APPLY</code> instead of <code>return ret == GTK_RESPONSE_NO</code> in <code>kb_find_duplicate()</code>, so it <em>allows</em> only if the response really is <code>APPLY</code> and not in any other possible case, no matter what is the response (another bug, future thing in the function, etc.).</p>

<p>I fixed this as I suggest in <a href="https://github.com/geany/geany/commit/d7750a44796b0ddc1c7a8968fd53aad91382d686" class="commit-link"><tt>d7750a4</tt></a>.  But thanks for the report, diagnostic and offering a fix!</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/geany/geany/pull/714#issuecomment-219591953">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ_JdEJQC1OJ5sf4zzlgYgLOYet8Uks5qCRLQgaJpZM4GXP8k.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/714#issuecomment-219591953"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>