Skip to content

Commit

Permalink
Fixed issue #6 Segmentation fault when media not found in player-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiadinos committed Feb 12, 2020
1 parent 72ac2b4 commit 644655c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/player-widget/region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,23 @@ void TRegion::startShowMedia(BaseMedia *media)
{
qDebug(Develop) << "begin" << Q_FUNC_INFO;
MyMedia = MyMediaFactory.initMedia(media);
layout.data()->addWidget(MyMedia->getView());

QWidget *widget = MyMedia->getView();
if (widget != Q_NULLPTR)
{
layout.data()->addWidget(widget);
}
qDebug(Develop) << "end" << Q_FUNC_INFO;
}

void TRegion::stopShowMedia()
{
qDebug(Develop) << "begin" << Q_FUNC_INFO;
layout.data()->removeWidget(MyMedia->getView());
QWidget *widget = MyMedia->getView();
if (widget != Q_NULLPTR)
{
layout.data()->removeWidget(widget);
}
MyMedia->deinit();
qDebug(Develop) << "end" << Q_FUNC_INFO;
}
Expand Down

0 comments on commit 644655c

Please sign in to comment.