[libdazzle] shortcuts: ensure proper access to private data



commit da3fea6acd41ad9c1cedac3023eb5cbf6f226c75
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 14 15:12:04 2017 -0700

    shortcuts: ensure proper access to private data
    
    We can't access this until after we've handled a NULL self.

 src/shortcuts/dzl-shortcut-manager.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-manager.c b/src/shortcuts/dzl-shortcut-manager.c
index ec981be..d5474fb 100644
--- a/src/shortcuts/dzl-shortcut-manager.c
+++ b/src/shortcuts/dzl-shortcut-manager.c
@@ -1165,8 +1165,7 @@ dzl_shortcut_manager_add_shortcut_entries (DzlShortcutManager     *self,
                                            guint                   n_shortcuts,
                                            const gchar            *translation_domain)
 {
-
-  DzlShortcutManagerPrivate *priv = dzl_shortcut_manager_get_instance_private (self);
+  DzlShortcutManagerPrivate *priv;
 
   g_return_if_fail (!self || DZL_IS_SHORTCUT_MANAGER (self));
   g_return_if_fail (shortcuts != NULL || n_shortcuts == 0);
@@ -1174,6 +1173,8 @@ dzl_shortcut_manager_add_shortcut_entries (DzlShortcutManager     *self,
   if (self == NULL)
     self = dzl_shortcut_manager_get_default ();
 
+  priv = dzl_shortcut_manager_get_instance_private (self);
+
   for (guint i = 0; i < n_shortcuts; i++)
     {
       const DzlShortcutEntry *entry = &shortcuts[i];


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]