mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fixed crash when changing theme after closing tab
This commit is contained in:
parent
2c5d05dfa1
commit
1654130dbc
|
@ -26,6 +26,11 @@ BaseWidget::BaseWidget(BaseWidget *parent, Qt::WindowFlags f)
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseWidget::~BaseWidget()
|
||||||
|
{
|
||||||
|
this->themeConnection.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
float BaseWidget::getScale() const
|
float BaseWidget::getScale() const
|
||||||
{
|
{
|
||||||
// return 1.f;
|
// return 1.f;
|
||||||
|
@ -82,15 +87,11 @@ void BaseWidget::setScaleIndependantHeight(int value)
|
||||||
|
|
||||||
void BaseWidget::init()
|
void BaseWidget::init()
|
||||||
{
|
{
|
||||||
pajlada::Signals::Connection connection = this->themeManager.updated.connect([this]() {
|
this->themeConnection = this->themeManager.updated.connect([this]() {
|
||||||
this->themeRefreshEvent();
|
this->themeRefreshEvent();
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(this, &QObject::destroyed, [connection]() mutable {
|
|
||||||
connection.disconnect(); //
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWidget::childEvent(QChildEvent *event)
|
void BaseWidget::childEvent(QChildEvent *event)
|
||||||
|
|
|
@ -20,6 +20,7 @@ public:
|
||||||
explicit BaseWidget(singletons::ThemeManager &_themeManager, QWidget *parent,
|
explicit BaseWidget(singletons::ThemeManager &_themeManager, QWidget *parent,
|
||||||
Qt::WindowFlags f = Qt::WindowFlags());
|
Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
explicit BaseWidget(BaseWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
|
explicit BaseWidget(BaseWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
virtual ~BaseWidget();
|
||||||
|
|
||||||
singletons::ThemeManager &themeManager;
|
singletons::ThemeManager &themeManager;
|
||||||
|
|
||||||
|
@ -49,6 +50,8 @@ private:
|
||||||
|
|
||||||
std::vector<BaseWidget *> widgets;
|
std::vector<BaseWidget *> widgets;
|
||||||
|
|
||||||
|
pajlada::Signals::Connection themeConnection;
|
||||||
|
|
||||||
static void setScaleRecursive(float scale, QObject *object);
|
static void setScaleRecursive(float scale, QObject *object);
|
||||||
|
|
||||||
friend class BaseWindow;
|
friend class BaseWindow;
|
||||||
|
|
|
@ -11,7 +11,7 @@ class SignalLabel : public QLabel
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SignalLabel(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
explicit SignalLabel(QWidget *parent = nullptr, Qt::WindowFlags f = 0);
|
||||||
~SignalLabel() override = default;
|
virtual ~SignalLabel() override = default;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mouseDoubleClick(QMouseEvent *ev);
|
void mouseDoubleClick(QMouseEvent *ev);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class SplitHeader : public BaseWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SplitHeader(Split *_chatWidget);
|
explicit SplitHeader(Split *_chatWidget);
|
||||||
~SplitHeader();
|
virtual ~SplitHeader();
|
||||||
|
|
||||||
// Update channel text from chat widget
|
// Update channel text from chat widget
|
||||||
void updateChannelText();
|
void updateChannelText();
|
||||||
|
|
Loading…
Reference in a new issue