summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/directfb/qdirectfbintegration.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2011-09-18 22:04:09 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-21 16:54:45 +0200
commitacd09c21f7e3f261b584eaf9136966439eaf3a8b (patch)
tree16a36b29f1f576a11003ba099124abd691ed8e56 /src/plugins/platforms/directfb/qdirectfbintegration.cpp
parent9e54d1deaba5fea1427f2f844b99e62ff73206d3 (diff)
[directfb] Use QScopedPointer to manage heap allocated objects
Use QScopedPointer to avoid trying to manually delete objects. For some of the cases the leak would only be viewable when things are getting shut down. Leave in some more warnings for cleaning it up, e.g. the m_eventBuffer of the Input is leaked and the input task will only stop after another key event. Change-Id: Ic54568343605b4ab7094a7dece40e22250184a37 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbintegration.cpp')
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index efa71ce361..96ba391a38 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -75,12 +75,7 @@ QDirectFbScreen::QDirectFbScreen(int display)
m_depth = QDirectFbConvenience::colorDepthForSurface(config.pixelformat);
m_physicalSize = QSizeF(config.width, config.height) * inch / dpi;
- m_cursor = new QDirectFBCursor(this);
-}
-
-QDirectFbScreen::~QDirectFbScreen()
-{
-#warning "Delete the cursor?"
+ m_cursor.reset(new QDirectFBCursor(this));
}
QDirectFbIntegration::QDirectFbIntegration()
@@ -111,18 +106,17 @@ QDirectFbIntegration::QDirectFbIntegration()
QDirectFbScreen *primaryScreen = new QDirectFbScreen(0);
screenAdded(primaryScreen);
- m_inputRunner = new QThread;
- m_input = new QDirectFbInput(0);
- m_input->moveToThread(m_inputRunner);
- QObject::connect(m_inputRunner,SIGNAL(started()),m_input,SLOT(runInputEventLoop()));
+ m_inputRunner.reset(new QThread);
+ m_input.reset(new QDirectFbInput(0));
+ m_input->moveToThread(m_inputRunner.data());
+ QObject::connect(m_inputRunner.data(), SIGNAL(started()),
+ m_input.data(), SLOT(runInputEventLoop()));
m_inputRunner->start();
}
QDirectFbIntegration::~QDirectFbIntegration()
{
m_input->stopInputEventLoop();
- delete m_inputRunner;
- delete m_input;
}
QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
@@ -135,8 +129,7 @@ QPlatformPixmap *QDirectFbIntegration::createPlatformPixmap(QPlatformPixmap::Pix
QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWindow *window) const
{
- QDirectFbInput *input = const_cast<QDirectFbInput *>(m_input);//gah
- return new QDirectFbWindow(window,input);
+ return new QDirectFbWindow(window,m_input.data());
}
QAbstractEventDispatcher *QDirectFbIntegration::guiThreadEventDispatcher() const