Merge pull request #6492 from jbroadus/fix-smartplaylist-crash

Fix smartplaylist crash
This commit is contained in:
John Maguire 2020-01-02 17:04:11 +00:00 committed by GitHub
commit e6e8090371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View File

@ -62,8 +62,8 @@ const char* PlaylistView::kSettingBackgroundImageFilename =
const int PlaylistView::kDefaultBlurRadius = 0;
const int PlaylistView::kDefaultOpacityLevel = 40;
PlaylistProxyStyle::PlaylistProxyStyle(QStyle* base)
: QProxyStyle(base), common_style_(new QCommonStyle) {}
PlaylistProxyStyle::PlaylistProxyStyle()
: QProxyStyle(), common_style_(new QCommonStyle) {}
void PlaylistProxyStyle::drawControl(ControlElement element,
const QStyleOption* option,
@ -107,7 +107,7 @@ void PlaylistProxyStyle::drawPrimitive(PrimitiveElement element,
PlaylistView::PlaylistView(QWidget* parent)
: QTreeView(parent),
app_(nullptr),
style_(new PlaylistProxyStyle(style())),
style_(new PlaylistProxyStyle),
playlist_(nullptr),
header_(new PlaylistHeader(Qt::Horizontal, this, this)),
setting_initial_header_layout_(false),

View File

@ -44,7 +44,7 @@ class QTimeLine;
// This class is used by the global search view as well.
class PlaylistProxyStyle : public QProxyStyle {
public:
PlaylistProxyStyle(QStyle* base);
PlaylistProxyStyle();
void drawControl(ControlElement element, const QStyleOption* option,
QPainter* painter, const QWidget* widget) const;
void drawPrimitive(PrimitiveElement element, const QStyleOption* option,

View File

@ -15,10 +15,11 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/logging.h"
#include "querywizardplugin.h"
#include "ui_wizardfinishpage.h"
#include "wizard.h"
#include "wizardplugin.h"
#include "ui_wizardfinishpage.h"
#include <QLabel>
#include <QRadioButton>
@ -106,6 +107,11 @@ void Wizard::SetGenerator(GeneratorPtr gen) {
finish_page_->ui_->name->setText(gen->name());
finish_page_->ui_->dynamic->setChecked(gen->is_dynamic());
if (type_index_ == -1) {
qLog(Error) << "Plugin was not found for generator type" << gen->type();
return;
}
// Tell the plugin to load
plugins_[type_index_]->SetGenerator(gen);
}