Fix app crash when callin StatusBar::clear twice during single app lifetime.

This commit is contained in:
Martin Rotter 2020-09-04 11:57:44 +02:00
parent 891ea481a1
commit 05a498393c
5 changed files with 7 additions and 8 deletions

View File

@ -92,7 +92,7 @@
<locale language="English" country="UnitedStates"/> <locale language="English" country="UnitedStates"/>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="m_tabInfo"> <widget class="QWidget" name="m_tabInfo">
<attribute name="title"> <attribute name="title">
@ -235,7 +235,7 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>83</width>
<height>69</height> <height>69</height>
</rect> </rect>
</property> </property>
@ -305,7 +305,7 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>83</width>
<height>69</height> <height>69</height>
</rect> </rect>
</property> </property>

View File

@ -228,6 +228,7 @@ void StatusBar::clear() {
if (should_remove_widget) { if (should_remove_widget) {
widget->deleteLater(); widget->deleteLater();
act->setProperty("widget", QVariant());
} }
if (should_remove_action) { if (should_remove_action) {

View File

@ -19,7 +19,7 @@ class StatusBar : public QStatusBar, public BaseBar {
Q_OBJECT Q_OBJECT
public: public:
explicit StatusBar(QWidget* parent = 0); explicit StatusBar(QWidget* parent = nullptr);
virtual ~StatusBar(); virtual ~StatusBar();
QList<QAction*> availableActions() const; QList<QAction*> availableActions() const;

View File

@ -36,7 +36,7 @@ class AdBlockIcon : public QAction {
Q_OBJECT Q_OBJECT
public: public:
explicit AdBlockIcon(AdBlockManager* parent = 0); explicit AdBlockIcon(AdBlockManager* parent = nullptr);
virtual ~AdBlockIcon(); virtual ~AdBlockIcon();
void popupBlocked(const QString& ruleString, const QUrl& url); void popupBlocked(const QString& ruleString, const QUrl& url);
@ -54,7 +54,6 @@ class AdBlockIcon : public QAction {
private: private:
AdBlockManager* m_manager; AdBlockManager* m_manager;
QVector<QPair<AdBlockRule*, QUrl>> m_blockedPopups; QVector<QPair<AdBlockRule*, QUrl>> m_blockedPopups;
QTimer* m_flashTimer; QTimer* m_flashTimer;
int m_timerTicks; int m_timerTicks;

View File

@ -68,6 +68,7 @@ class AdBlockManager : public QObject {
bool removeSubscription(AdBlockSubscription* subscription); bool removeSubscription(AdBlockSubscription* subscription);
AdBlockCustomList* customList() const; AdBlockCustomList* customList() const;
inline AdBlockIcon* adBlockIcon() const { inline AdBlockIcon* adBlockIcon() const {
return m_adblockIcon; return m_adblockIcon;
} }
@ -89,12 +90,10 @@ class AdBlockManager : public QObject {
bool m_loaded; bool m_loaded;
bool m_enabled; bool m_enabled;
AdBlockIcon* m_adblockIcon; AdBlockIcon* m_adblockIcon;
QList<AdBlockSubscription*> m_subscriptions; QList<AdBlockSubscription*> m_subscriptions;
AdBlockMatcher* m_matcher; AdBlockMatcher* m_matcher;
QStringList m_disabledRules; QStringList m_disabledRules;
AdBlockUrlInterceptor* m_interceptor; AdBlockUrlInterceptor* m_interceptor;
QPointer<AdBlockDialog> m_adBlockDialog; QPointer<AdBlockDialog> m_adBlockDialog;
QMutex m_mutex; QMutex m_mutex;
}; };