Skip to content

Commit

Permalink
Updated src/widgets/tabbar.cpp
Browse files Browse the repository at this point in the history
Fixed crash with multirow tabs (MSVC)
Less type conversions
  • Loading branch information
Vitozz committed Mar 8, 2019
1 parent 9bc42e8 commit 8c65248
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/widgets/tabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <QLine>
#include <QDrag>
#include <QMimeData>
#include <memory>
//#include <QDebug>

#define PINNED_CHARS 6
Expand Down Expand Up @@ -121,7 +122,7 @@ TabBar::Private::Private(TabBar *base)

LayoutSf possibleLayouts2(const QList<int> &tabs, int barWidth, int rows, double baseSf)
{
int layouts[50 * 10000]; // FIXME
std::unique_ptr<int[]> layouts(new int[50 * 10000]);
for (int i = 0; i < rows; ++i) {
layouts[i] = i;
}
Expand Down Expand Up @@ -335,7 +336,7 @@ void TabBar::Private::layoutTabs()
normalRows = rows - pinnedRows;
}

double sf = static_cast<float>(barWidth * normalRows) / tabsWidthHint;
double sf = static_cast<double>(barWidth * normalRows) / tabsWidthHint;
LayoutSf layout;
if (rows == 1 || hackedTabs.size() == 1) {
// Only one row in bar
Expand Down Expand Up @@ -369,7 +370,7 @@ void TabBar::Private::layoutTabs()
if (layout.isEmpty()) {
normalRows++;
rows++;
sf = static_cast<float>(barWidth * normalRows) / tabsWidthHint;
sf = static_cast<double>(barWidth * normalRows) / tabsWidthHint;
}
}
cachedLayout.layout = layout;
Expand Down

0 comments on commit 8c65248

Please sign in to comment.