summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui_gtk.cc4
-rw-r--r--src/gui_qt.cc4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc
index 574cf84..e80a249 100644
--- a/src/gui_gtk.cc
+++ b/src/gui_gtk.cc
@@ -2042,7 +2042,7 @@ std::string GtkGuiMenu::add_action(std::string const& id) {
if (parent_) return parent_->add_action(id);
std::string name = escape(id);
auto action = g_simple_action_new(name.c_str(), nullptr);
- action_.emplace(id, action);
+ action_[id].reset(action);
g_signal_connect(action, "activate", G_CALLBACK(menu_item_activate), this);
if (map_) g_action_map_add_action(map_, G_ACTION(action));
return "app." + name;
@@ -2066,7 +2066,7 @@ public:
auto handle = new Fd(channel, callback);
handle->watch_ = g_io_add_watch(channel, events2cond(events),
&GtkLooper::event, handle);
- fds_.emplace(fd, handle);
+ fds_[fd].reset(handle);
}
void modify(int fd, uint8_t events) override {
diff --git a/src/gui_qt.cc b/src/gui_qt.cc
index 4d6eba1..499ac08 100644
--- a/src/gui_qt.cc
+++ b/src/gui_qt.cc
@@ -1654,8 +1654,8 @@ public:
}
void add(int fd, uint8_t events, FdCallback const& callback) override {
- auto pair = fds_.emplace(fd, new Fd(fd, callback));
- auto& handle = pair.first->second;
+ auto& handle = fds_[fd];
+ handle.reset(new Fd(fd, callback));
handle->read_->setEnabled(events & EVENT_READ);
handle->write_->setEnabled(events & EVENT_WRITE);
}