Fix a bug that caused startup to hang

This commit is contained in:
Florian Märkl 2017-11-30 15:00:22 +01:00
parent 691d567c61
commit 6c3d1d2582
2 changed files with 24 additions and 8 deletions

View File

@ -31,7 +31,12 @@ DisassemblyWidget::DisassemblyWidget(QWidget *parent)
setAllowedAreas(Qt::AllDockWidgetAreas); setAllowedAreas(Qt::AllDockWidgetAreas);
setObjectName("DisassemblyWidget"); setObjectName("DisassemblyWidget");
colorsUpdatedSlot();
setupFonts();
setupColors();
maxLines = 0;
updateMaxLines();
mDisasTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mDisasTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mDisasTextEdit->setFont(Config()->getFont()); mDisasTextEdit->setFont(Config()->getFont());
@ -52,9 +57,6 @@ DisassemblyWidget::DisassemblyWidget(QWidget *parent)
connect(mDisasTextEdit, SIGNAL(customContextMenuRequested(const QPoint &)), connect(mDisasTextEdit, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showDisasContextMenu(const QPoint &))); this, SLOT(showDisasContextMenu(const QPoint &)));
maxLines = 0;
updateMaxLines();
// Space to switch to graph // Space to switch to graph
QShortcut *graphShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this); QShortcut *graphShortcut = new QShortcut(QKeySequence(Qt::Key_Space), this);
@ -453,7 +455,7 @@ void DisassemblyWidget::raisePrioritizedMemoryWidget(CutterCore::MemoryWidgetTyp
void DisassemblyWidget::fontsUpdatedSlot() void DisassemblyWidget::fontsUpdatedSlot()
{ {
mDisasTextEdit->setFont(Config()->getFont()); setupFonts();
if (!updateMaxLines()) // updateMaxLines() returns true if it already refreshed. if (!updateMaxLines()) // updateMaxLines() returns true if it already refreshed.
{ {
@ -463,12 +465,23 @@ void DisassemblyWidget::fontsUpdatedSlot()
void DisassemblyWidget::colorsUpdatedSlot() void DisassemblyWidget::colorsUpdatedSlot()
{ {
mDisasTextEdit->setStyleSheet(QString("QPlainTextEdit { background-color: %1; color: %2; }") setupColors();
.arg(ConfigColor("gui.background").name())
.arg(ConfigColor("btext").name()));
refreshDisasm(); refreshDisasm();
} }
void DisassemblyWidget::setupFonts()
{
mDisasTextEdit->setFont(Config()->getFont());
}
void DisassemblyWidget::setupColors()
{
mDisasTextEdit->setStyleSheet(QString("QPlainTextEdit { background-color: %1; color: %2; }")
.arg(ConfigColor("gui.background").name())
.arg(ConfigColor("btext").name()));
}
DisassemblyScrollArea::DisassemblyScrollArea(QWidget *parent) : QAbstractScrollArea(parent) DisassemblyScrollArea::DisassemblyScrollArea(QWidget *parent) : QAbstractScrollArea(parent)
{ {
} }

View File

@ -51,6 +51,9 @@ private:
RVA readDisassemblyOffset(QTextCursor tc); RVA readDisassemblyOffset(QTextCursor tc);
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
void setupFonts();
void setupColors();
void updateCursorPosition(); void updateCursorPosition();
void connectCursorPositionChanged(bool disconnect); void connectCursorPositionChanged(bool disconnect);