mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Message menu now holds a shared pointer to a layout (#1787)
This ensures that the layout will survive for the lifetime of the menu, so any of the menu actions can with confidence do things with the layout, not having to worry whether it's dead or not. This means that the user, while having the message menu open, could have one extra MessageLayout alive. I have ensured that when the menu dies the reference to the shared pointer dies with it.
This commit is contained in:
parent
e4af009fda
commit
cdf85c5084
|
@ -9,5 +9,6 @@
|
||||||
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
||||||
- Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602)
|
- Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602)
|
||||||
- Bugfix: MacOS updater looked for non-existing fields, causing it to always fail the update check (#1642)
|
- Bugfix: MacOS updater looked for non-existing fields, causing it to always fail the update check (#1642)
|
||||||
|
- Bugfix: Fixed message menu crashing if the message you right-clicked goes out of scope before you select an action (#1783) (#1787)
|
||||||
- Settings open faster
|
- Settings open faster
|
||||||
- Dev: Fully remove Twitch Chatroom support
|
- Dev: Fully remove Twitch Chatroom support
|
||||||
|
|
|
@ -1570,12 +1570,12 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle the click
|
// handle the click
|
||||||
this->handleMouseClick(event, hoverLayoutElement, layout.get());
|
this->handleMouseClick(event, hoverLayoutElement, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelView::handleMouseClick(QMouseEvent *event,
|
void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||||
const MessageLayoutElement *hoveredElement,
|
const MessageLayoutElement *hoveredElement,
|
||||||
MessageLayout *layout)
|
MessageLayoutPtr layout)
|
||||||
{
|
{
|
||||||
switch (event->button())
|
switch (event->button())
|
||||||
{
|
{
|
||||||
|
@ -1593,7 +1593,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||||
auto &link = hoveredElement->getLink();
|
auto &link = hoveredElement->getLink();
|
||||||
if (!getSettings()->linksDoubleClickOnly)
|
if (!getSettings()->linksDoubleClickOnly)
|
||||||
{
|
{
|
||||||
this->handleLinkClick(event, link, layout);
|
this->handleLinkClick(event, link, layout.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke to signal from EmotePopup.
|
// Invoke to signal from EmotePopup.
|
||||||
|
@ -1631,7 +1631,7 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||||
auto &link = hoveredElement->getLink();
|
auto &link = hoveredElement->getLink();
|
||||||
if (!getSettings()->linksDoubleClickOnly)
|
if (!getSettings()->linksDoubleClickOnly)
|
||||||
{
|
{
|
||||||
this->handleLinkClick(event, link, layout);
|
this->handleLinkClick(event, link, layout.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1640,13 +1640,15 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelView::addContextMenuItems(
|
void ChannelView::addContextMenuItems(
|
||||||
const MessageLayoutElement *hoveredElement, MessageLayout *layout)
|
const MessageLayoutElement *hoveredElement, MessageLayoutPtr layout)
|
||||||
{
|
{
|
||||||
const auto &creator = hoveredElement->getCreator();
|
const auto &creator = hoveredElement->getCreator();
|
||||||
auto creatorFlags = creator.getFlags();
|
auto creatorFlags = creator.getFlags();
|
||||||
|
|
||||||
static QMenu *menu = new QMenu;
|
auto menu = new QMenu;
|
||||||
menu->clear();
|
connect(menu, &QMenu::aboutToHide, [menu] {
|
||||||
|
menu->deleteLater(); //
|
||||||
|
});
|
||||||
|
|
||||||
// Emote actions
|
// Emote actions
|
||||||
if (creatorFlags.hasAny(
|
if (creatorFlags.hasAny(
|
||||||
|
|
|
@ -145,9 +145,9 @@ private:
|
||||||
|
|
||||||
void handleMouseClick(QMouseEvent *event,
|
void handleMouseClick(QMouseEvent *event,
|
||||||
const MessageLayoutElement *hoverLayoutElement,
|
const MessageLayoutElement *hoverLayoutElement,
|
||||||
MessageLayout *layout);
|
MessageLayoutPtr layout);
|
||||||
void addContextMenuItems(const MessageLayoutElement *hoveredElement,
|
void addContextMenuItems(const MessageLayoutElement *hoveredElement,
|
||||||
MessageLayout *layout);
|
MessageLayoutPtr layout);
|
||||||
int getLayoutWidth() const;
|
int getLayoutWidth() const;
|
||||||
void updatePauses();
|
void updatePauses();
|
||||||
void unpaused();
|
void unpaused();
|
||||||
|
|
Loading…
Reference in a new issue