<p>Normally a plugin would connect using its own plugin object, this is what I expect for peasy based ones at least:</p>

<pre><code>def on_document_new(self, doc):
  pass
def do_enable(self):
 self.geany_plugin.geany_data.object.connect("document-new", self.on_document_new)
</code></pre>

<p>In this case the signal connection is automatically cleaned up when <code>self</code> is destructed, i.e. when geany (via peasy) unloads the plugin.</p>

<p>I'm not sure we can enforce such behavior for all GI based plugins but I expect the most common cases are handled like above. </p>

<p>Also, we can't enforce it for plain C plugins either (for non-geany_object signals) since those can too always use plain g_object_connect().</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, <a href="https://github.com/geany/geany/pull/1038#issuecomment-223812224">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/ABDrJy0rlqxcXSdeeYrC6RM8Iyu5mQegks5qIsqGgaJpZM4Ifw_7">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ7vu2VKmWgqQfhtYt21VjYNm0ZQSks5qIsqGgaJpZM4Ifw_7.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/1038#issuecomment-223812224"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>