~indicator-applet-developers/hud/trunk.14.04

« back to all changes in this revision

Viewing changes to tests/unit/qtgmenu/TestQtGMenu.cpp

  • Committer: CI bot
  • Author(s): Pete Woods, Marcus Tomlinson
  • Date: 2014-06-04 14:04:03 UTC
  • mfrom: (390.1.44 trunk)
  • Revision ID: ps-jenkins@lists.canonical.com-20140604140403-a70c33snru5b6k4x
Harden HUD against misbehaving applications

Report the offending applications using Apport's recoverable problem tool.
Switch to using shared pointers where possible for managing memory. Fixes: 1298656, 1316473, 1322050, 1325538

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
  int GetGMenuSize()
73
73
  {
74
 
    GMenuModel* menu = m_importer.GetGMenuModel();
 
74
    QSharedPointer<GMenuModel> menu = m_importer.GetGMenuModel();
75
75
 
76
76
    if( !menu )
77
77
    {
78
78
      return 0;
79
79
    }
80
80
 
81
 
    gint item_count = g_menu_model_get_n_items( G_MENU_MODEL( menu ) );
 
81
    gint item_count = g_menu_model_get_n_items( G_MENU_MODEL( menu.data() ) );
82
82
 
83
83
    return item_count;
84
84
  }
85
85
 
86
86
  int GetGActionCount()
87
87
  {
88
 
    GActionGroup* actions = m_importer.GetGActionGroup();
 
88
    QSharedPointer<GActionGroup> actions = m_importer.GetGActionGroup();
89
89
 
90
90
    if( !actions )
91
91
    {
92
92
      return 0;
93
93
    }
94
94
 
95
 
    gchar** actions_list = g_action_group_list_actions( actions );
 
95
    gchar** actions_list = g_action_group_list_actions( actions.data() );
96
96
 
97
97
    int action_count = 0;
98
98
    while( actions_list[action_count] != nullptr )