GDBusInterfaceVTable: clarify memory handling for the method() virtual function
[platform/upstream/glib.git] / gio / gregistrysettingsbackend.c
index 1b4c119..cf9da0b 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Sam Thursfield <ssssam@gmail.com>
  */
@@ -1756,8 +1754,12 @@ watch_add_notify (GRegistryBackend *self,
   EnterCriticalSection (self->cache_lock);
   cache_node = registry_cache_get_node_for_key (self->cache_root, gsettings_prefix, TRUE);
 
-  g_return_val_if_fail (cache_node != NULL, FALSE);
-  g_return_val_if_fail (cache_node->data != NULL, FALSE);
+  if (cache_node == NULL || cache_node->data == NULL)
+    {
+      LeaveCriticalSection (self->cache_lock);
+      g_warn_if_reached ();
+      return FALSE;
+    }
   
   cache_item = cache_node->data;
 
@@ -1766,6 +1768,7 @@ watch_add_notify (GRegistryBackend *self,
     {
       trace ("watch_add_notify: prefix %s already watched, %i subscribers.\n",
              gsettings_prefix, cache_item->subscription_count);
+      LeaveCriticalSection (self->cache_lock);
       return FALSE;
     }