惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Webroot Blog
Webroot Blog
AI
AI
P
Palo Alto Networks Blog
Attack and Defense Labs
Attack and Defense Labs
WordPress大学
WordPress大学
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
Spread Privacy
Spread Privacy
T
Tor Project blog
罗磊的独立博客
小众软件
小众软件
S
Security Affairs
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
Apple Machine Learning Research
Apple Machine Learning Research
T
Threatpost
NISL@THU
NISL@THU
博客园_首页
PCI Perspectives
PCI Perspectives
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
N
News and Events Feed by Topic
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Forbes - Security
Forbes - Security
博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Security Latest
Security Latest
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Cloudflare Blog
A
About on SuperTechFans
爱范儿
爱范儿
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
TaoSecurity Blog
TaoSecurity Blog
宝玉的分享
宝玉的分享
G
GRAHAM CLULEY
雷峰网
雷峰网
F
Full Disclosure
I
Intezer
Cloudbric
Cloudbric
博客园 - 三生石上(FineUI控件)
U
Unit 42

Virtual Reality

Implementing WebXR in WebKit for WPE A New Way to Browse: Eye Tracking Comes to Wolvic! Flexbox Cats (a.k.a fixing images in flexbox) Closing the gap (in flexbox 😇) Automatizing the Grid BlinkOn 3 I'm attending BlinkOn3 Grids everywhere! Adventures in the Grid Improving the editing code in WebKit http://publicsuffix.org support coming to libsoup ReSiStance 0.9.2 released ReSiStance 0.8 with Google Reader support WebKitGtk+ HTTP cache ready! ReSiStance 0.5 released ReSiStance with WebKitGtk inside Vive la ReSiStance! Tinymail 1.0 released The Postman always rings twice Some Modest sir? Sure, with Sugar please Moblin support for Tinymail Dear GMail IMAP server developers Another One Bites the Dust Modest with BODYSTRUCTURE support Speed, speed, speed !!! The beauty of git GCDS day #3 (a.k.a. GUADEC day #2) GCDS day #2 (a.k.a. GUADEC day #1) Igalia' new office party Modest @ FreeNode Modest Reloaded Back from GUADEC Get in touch Modest released! JHBuild and SVN problem Our little babies Igalia in the news Be Modest my friend Our dreams came true Faster is better They're coming, don't let them go Dancing with mailboxes Drag and drop with sorted tree models (2) Drag and drop with sorted tree models Not so tiny ChangeLog Turn a GtkMenuBar into a GtkMenu Not so tiny(mail) Ekiga builds 😀 The 3.60 happiness movement GNOME 2.16 is dead. Long live GNOME 2.18 Lightweight apps Bye bye, Pluto Back to home/work/sound The real (virtual?) telepathy Mozilla Thunderbird 1 Evolution 0 What is a galago? Very special numbers Again with some DBUS stuff Gedit hacking; porting gedit to use D-BUS
I want my GConf notifications
svillar · 2007-09-27 · via Virtual Reality

While hacking a little bit with GConf I found what IMHO is an undesirable behaviour of GConf. I think most of developers will agree because you don’t want your application to run in a different way than the one you expected when you designed it. And this happens in the following situation:

I set up a GConfClient to listen to changes in keys under a specific directory. I wrote also a handler for this GConf notifications hoping that I’ll get every change in those keys (the API doc literally says “Any changes to keys below this directory will cause the “value_changed” signal to be emitted”). So I relied in this GConf notification handler some important code of my application. But, while executing the application I realized that I was not getting some notifications even tough I was completely sure that I was setting a new value in the GConf key. So, I had to take a deeper look…

I verified that the GConf server was issuing a notification for every change I made, so the problem should be in the client. Looking at the GConfClient code I found the following in the notify_from_server_callback function:

changed = gconf_client_cache (client, FALSE, entry, TRUE);

if (!changed)
return; /* don't do the notify */

gconf_client_queue_notify (client, entry->key);

What? This means that I won’t get notifications if the key is already updated in the client cache? What’s the reason for such a behaviour? I don’t think this is what a developer expects, specially for a system that uses idles for notifications (you could never be sure when you’ll get it), because it could cause things like the one that was happening to me:

  • As a response to a user action I was setting a new value to a GConf key
  • Before the GConfServer notified the GConfClient, there was some other code that was trying to get the new value of the same key
  • GConf cached the new value in the client while doing the get operation
  • The GConfClient received the GConfServer notification, but was not issuing a notification because the value was already updated
  • I was scratching my head trying to figure out what the hell was happening … 😀

So, IMHO there are two possibilities

  1. Always notify
  2. Write in bold 46-point sized font that sometimes you could not get notifications because of that

Anyway, it’s always good to look into the guts of the software you use.