<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Regression: "notify::title" signal unreliably triggered multiple times"
href="https://bugs.webkit.org/show_bug.cgi?id=165073#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Regression: "notify::title" signal unreliably triggered multiple times"
href="https://bugs.webkit.org/show_bug.cgi?id=165073">bug 165073</a>
from <span class="vcard"><a class="email" href="mailto:luke@ubuntu-mate.org" title="luke@ubuntu-mate.org">luke@ubuntu-mate.org</a>
</span></b>
<pre>It would be good to know whether this is a bug or an intentional change and what our options are.
In the meantime, I have written a crude workaround (in the application's code) that restores 2.12 behaviour in >=2.14:
====================================
To be placed in __init__ function:
self.cmd_buffer = []
self.cmd_set = False
To be placed in 'notify::title' callback function:
# Ignore NULL
if len(title) == 0:
return
else:
self.cmd_buffer.append(title)
# Once the page is loaded, first command works fine.
# Subsequential clicks on anything else causes 2 callbacks.
if self.cmd_set:
if not len(self.cmd_buffer) >= 2:
return
self.cmd_buffer = []
self.cmd_set = True
To be placed in 'load-changed' callback function:
self.cmd_set = False
====================================
This comes at with the risk the app may ignore further 'notify::title' signals unless the user clicks a button (in-app) again. This will also be apparent if the behaviour changes again in WebKit2GTK, or a user has an older version of WebKit2. At least now a "command" only runs once.
This workaround has been applied to these 2 apps:
* <a href="https://github.com/lah7/polychromatic/commit/cbde66e9cc84d86485c4f8b8c57b3b5aa0dceb9c">https://github.com/lah7/polychromatic/commit/cbde66e9cc84d86485c4f8b8c57b3b5aa0dceb9c</a>
* <a href="https://bitbucket.org/ubuntu-mate/ubuntu-mate-welcome/commits/5210c5dd2567d8a66217819e0784932a60e7c36d?at=master">https://bitbucket.org/ubuntu-mate/ubuntu-mate-welcome/commits/5210c5dd2567d8a66217819e0784932a60e7c36d?at=master</a>
Ubuntu 16.04 has also updated the packages to 2.14, so any other WebKit2 GTK-based application may want to be wary of the changes to this 'notify::title' signal.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>