fix some lifetime stuff

This commit is contained in:
ouwou
2021-01-09 23:33:31 -05:00
parent 4d62944dbb
commit def598941a
2 changed files with 6 additions and 9 deletions

View File

@@ -274,15 +274,14 @@ ChannelList::ChannelList() {
// maybe will regret doing it this way
auto &discord = Abaddon::Get().GetDiscordClient();
discord.signal_message_create().connect(sigc::track_obj([this, &discord](Snowflake message_id) {
auto cb = [this, &discord](Snowflake message_id) {
const auto message = discord.GetMessage(message_id);
const auto channel = discord.GetChannel(message->ChannelID);
if (!channel.has_value()) return;
if (channel->Type == ChannelType::DM || channel->Type == ChannelType::GROUP_DM)
CheckBumpDM(message->ChannelID);
// clang-format off
}, this));
// clang-format on
};
discord.signal_message_create().connect(sigc::track_obj(cb, *this));
}
Gtk::Widget *ChannelList::GetRoot() const {

View File

@@ -443,11 +443,10 @@ Gtk::Widget *ChatMessageItemContainer::CreateStickerComponent(const StickerData
auto &img = Abaddon::Get().GetImageManager();
if (data.FormatType == StickerFormatType::PNG || data.FormatType == StickerFormatType::APNG) {
// clang-format off
img.LoadFromURL(data.GetURL(), sigc::track_obj([this, imgw](const Glib::RefPtr<Gdk::Pixbuf> &pixbuf) {
auto cb = [this, imgw](const Glib::RefPtr<Gdk::Pixbuf> &pixbuf) {
imgw->property_pixbuf() = pixbuf;
}, imgw));
// clang-format on
};
img.LoadFromURL(data.GetURL(), sigc::track_obj(cb, *imgw));
}
AttachEventHandlers(*box);
@@ -521,7 +520,6 @@ Gtk::Widget *ChatMessageItemContainer::CreateReactionsComponent(const Message &d
img = Gtk::manage(new Gtk::Image(pb->scale_simple(16, 16, Gdk::INTERP_BILINEAR)));
} else {
img = Gtk::manage(new Gtk::Image(placeholder));
// can track_obj PLEASE work ???
imgr.LoadFromURL(reaction.Emoji.GetURL(), sigc::bind<0>(sigc::mem_fun(*this, &ChatMessageItemContainer::ReactionUpdateImage), img));
}
img->set_can_focus(false);