mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kmediaplayer: use QPointer<T> to store the KMediaWidget pointer
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d874397ed4
commit
57be009258
2 changed files with 7 additions and 2 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
#include <KPluginFactory>
|
||||
#include <KDebug>
|
||||
|
||||
K_PLUGIN_FACTORY(KMediaPlayerPartFactory, registerPlugin<KMediaPlayerPart>();) // produce a factory
|
||||
K_EXPORT_PLUGIN(KMediaPlayerPartFactory(KAboutData(
|
||||
|
@ -45,12 +46,15 @@ KMediaPlayerPart::KMediaPlayerPart(QWidget *parentWidget, QObject *parent, const
|
|||
Q_UNUSED(arguments);
|
||||
setComponentData(KMediaPlayerPartFactory::componentData());
|
||||
setWidget(m_player);
|
||||
setAutoDeleteWidget(false); // will be deleted in destructor, if still valid
|
||||
m_player->player()->setPlayerID("kmediaplayerpart");
|
||||
}
|
||||
|
||||
KMediaPlayerPart::~KMediaPlayerPart()
|
||||
{
|
||||
delete m_player;
|
||||
if (m_player) {
|
||||
delete m_player.data();
|
||||
}
|
||||
}
|
||||
|
||||
bool KMediaPlayerPart::openUrl(const KUrl &url)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef KMEDIAPART_H
|
||||
#define KMEDIAPART_H
|
||||
|
||||
#include <QPointer>
|
||||
#include <KParts/Part>
|
||||
#include <KMediaWidget>
|
||||
#include <KUrl>
|
||||
|
@ -37,7 +38,7 @@ public Q_SLOTS:
|
|||
bool openUrl(const KUrl &url) final;
|
||||
|
||||
private:
|
||||
KMediaWidget *m_player;
|
||||
QPointer<KMediaWidget> m_player;
|
||||
};
|
||||
|
||||
#endif // KMEDIAPART_H
|
||||
|
|
Loading…
Add table
Reference in a new issue