From d9edef324f62b27b58756f9a2f845928896ac8ba Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Thu, 25 Feb 2016 22:30:27 +0100 Subject: [PATCH] Fixed an issue in TabWidget's artwork tabs autosize function that makes gdb crash with SIGFPE. --- src/gui/widgets/TabWidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/TabWidget.cpp b/src/gui/widgets/TabWidget.cpp index 6fb3c54cd..e8862d457 100644 --- a/src/gui/widgets/TabWidget.cpp +++ b/src/gui/widgets/TabWidget.cpp @@ -252,10 +252,16 @@ void TabWidget::paintEvent( QPaintEvent * _pe ) } p.setPen( cap_col ); - // Draw all tabs + // Compute tabs' width depending on the number of tabs (only applicable for artwork tabs) widgetStack::iterator first = m_widgets.begin(); widgetStack::iterator last = m_widgets.end(); - int tab_width = ( width() - tab_x_offset ) / std::distance( first, last ); // Correct tab's width for artwork tabs + int tab_width = width(); + if ( first != last ) + { + tab_width = ( width() - tab_x_offset ) / std::distance( first, last ); + } + + // Draw all tabs for( widgetStack::iterator it = first ; it != last ; ++it ) {