mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 20:35:36 +00:00
Fix most of critical issues reported by Sonar (GTK client) (#2309)
* (C++) Macros should not be used to define constants * (C++) Memory should not be managed manually * (C++) "void*" should not be used in typedefs, member variables, function parameters or return type * (C++) When the "Rule-of-Zero" is not applicable, the "Rule-of-Five" should be followed * (C++) "switch" statements should have "default" clauses * (C++) "explicit" should be used on single-parameter constructors and conversiosn operators * (C++) Non-const global variables should not be used
This commit is contained in:
@@ -43,6 +43,8 @@ public:
|
||||
Impl(MainWindow& window, Glib::RefPtr<Gio::ActionGroup> const& actions, Glib::RefPtr<Session> const& core);
|
||||
~Impl();
|
||||
|
||||
TR_DISABLE_COPY_MOVE(Impl)
|
||||
|
||||
Glib::RefPtr<Gtk::TreeSelection> get_selection() const;
|
||||
|
||||
void refresh();
|
||||
@@ -142,7 +144,7 @@ Gtk::TreeView* MainWindow::Impl::makeview(Glib::RefPtr<Gtk::TreeModel> const& mo
|
||||
|
||||
selection_ = view->get_selection();
|
||||
|
||||
column_ = new Gtk::TreeViewColumn();
|
||||
column_ = Gtk::make_managed<Gtk::TreeViewColumn>();
|
||||
column_->set_title(_("Torrent"));
|
||||
column_->set_resizable(true);
|
||||
column_->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED);
|
||||
@@ -594,7 +596,7 @@ MainWindow::Impl::Impl(MainWindow& window, Glib::RefPtr<Gio::ActionGroup> const&
|
||||
|
||||
tr_sessionSetAltSpeedFunc(
|
||||
core_->get_session(),
|
||||
[](tr_session* /*s*/, bool /*isEnabled*/, bool /*byUser*/, void* p)
|
||||
[](tr_session* /*s*/, bool /*isEnabled*/, bool /*byUser*/, gpointer p)
|
||||
{ Glib::signal_idle().connect_once([p]() { static_cast<Impl*>(p)->onAltSpeedToggledIdle(); }); },
|
||||
this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user