Memchecking plasma

Michael Jansen kde at michael-jansen.biz
Sat Jul 18 22:18:06 CEST 2009


kickoff/ui/launcher.cpp:272



 void registerUrlHandlers()
 {
        UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ExtensionHandler, 
"desktop", new ServiceItemHandler);
        UrlItemLauncher::addGlobalHandler(UrlItemLauncher::ProtocolHandler, 
"leave", new LeaveItemHandler);
    }

Both ItemHandler instantiated above leak because noone will ever delete them 
(see below for memcheck output).

Solution 1: 
Make the qobjects and parent/reparent them. One already inherits from QObject.

Solution 2: 
In UrlItemLauncher::~UrlItemLauncher() delete content of 
UrlItemLauncher::Private::globalHandlers.insert(name, info);

Solution 3:
??


==26061== 8 bytes in 1 blocks are definitely lost in loss record 4 of 302
==26061==    at 0x4C2535C: operator new(unsigned long) (in 
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==26061==    by 0x237E39E0: Kickoff::Launcher::Private::registerUrlHandlers() 
(launcher.cpp:274)
==26061==    by 0x237E1280: Kickoff::Launcher::init() (launcher.cpp:511)
==26061==    by 0x237E16DB: Kickoff::Launcher::Launcher(Plasma::Applet*) 
(launcher.cpp:478)
==26061==    by 0x237EC968: LauncherApplet::Private::createLauncher() 
(applet.cpp:75)
==26061==    by 0x237ECA3C: LauncherApplet::widget() (applet.cpp:239)
==26061==    by 0x54255BB: 
Plasma::PopupAppletPrivate::popupConstraintsEvent(QFlags<Plasma::Constraint>) 
(popupapplet.cpp:178)
==26061==    by 0x53DF936: Plasma::Applet::flushPendingConstraintsEvents() 
(applet.cpp:1165)
==26061==    by 0x5401603: Plasma::Corona::loadLayout(QString const&) 
(corona.cpp:379)
==26061==    by 0x540182D: Plasma::Corona::initializeLayout(QString const&) 
(corona.cpp:324)
==26061==    by 0x4E7CEDE: PlasmaApp::corona() (plasmaapp.cpp:540)
==26061==    by 0x4E7E7ED: PlasmaApp::setupDesktop() (plasmaapp.cpp:252)
==26061==    by 0x4E7E9BC: PlasmaApp::qt_metacall(QMetaObject::Call, int, 
void**) (plasmaapp.moc:115)
==26061==    by 0x9AAA7C7: QMetaObject::activate(QObject*, int, int, void**) 
(qobject.cpp:3115)
==26061==    by 0x9AABB88: QMetaObject::activate(QObject*, QMetaObject const*, 
int, void**) (qobject.cpp:3192)
==26061==    by 0x9AB28E3: QSingleShotTimer::timeout() (qtimer.moc:76)
==26061==    by 0x9AB29DA: QSingleShotTimer::timerEvent(QTimerEvent*) 
(qtimer.cpp:298)
==26061==    by 0x9AA68CB: QObject::event(QEvent*) (qobject.cpp:1065)
==26061==    by 0x8B7786C: QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (qapplication.cpp:4106)
==26061==    by 0x8B8050B: QApplication::notify(QObject*, QEvent*) 
(qapplication.cpp:3632)
==26061==    by 0x68A417D: KApplication::notify(QObject*, QEvent*) 
(kapplication.cpp:302)
==26061==    by 0x9A94480: QCoreApplication::notifyInternal(QObject*, QEvent*) 
(qcoreapplication.cpp:620)
==26061==    by 0x8B741E4: QCoreApplication::sendEvent(QObject*, QEvent*) 
(qcoreapplication.h:213)
==26061==    by 0x9AC5D58: QTimerInfoList::activateTimers() 
(qeventdispatcher_unix.cpp:580)
==26061==    by 0x9AC3541: timerSourceDispatch(_GSource*, int (*)(void*), 
void*) (qeventdispatcher_glib.cpp:165)
==26061==    by 0xDA370FA: g_main_context_dispatch (in 
/usr/lib64/libglib-2.0.so.0.1800.2)
==26061==    by 0xDA3A8CC: (within /usr/lib64/libglib-2.0.so.0.1800.2)
==26061==    by 0xDA3AA8A: g_main_context_iteration (in 
/usr/lib64/libglib-2.0.so.0.1800.2)
==26061==    by 0x9AC2719: 
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(qeventdispatcher_glib.cpp:327)
==26061==    by 0x8C30042: 
QGuiEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(qguieventdispatcher_glib.cpp:202)


More information about the Plasma-devel mailing list