Fix unsetting associated application/urls for Plasma::Applets
ClosedPublic

Authored by kossebau on Apr 10 2016, 2:04 AM.

Details

Summary

Avoids a crash and a bogus menu entry.

Current code does not properly handle any resetting, which results
in Applet::hasValidAssociatedApplication() still returning true
when urls have been set to an empty list and the application name
to an empty string.
Also are connections to the "destroyed" signal collected on
repeated set calls.
This patch fixes that.

This fixes "Run the Associated Application" menu entry showing up with widgets.

It also prevents the crash in associatedapplicationmanager.cpp:76, which assumes
url lists to be non-empty:
const QString mimeType = mimeDb.mimeTypeForUrl(i.value().first()).name();

Not happy yet with the signal/slot connection management,
improvement proposals welcome.

Diff Detail

Branch
allowAssignedUrlAppUnsetting
Lint
No Linters Available
Unit
No Unit Test Coverage
kossebau updated this revision to Diff 3249.Apr 10 2016, 2:04 AM
kossebau retitled this revision from to Fix unsetting associated application/urls for applets.
kossebau updated this object.
kossebau edited the test plan for this revision. (Show Details)
kossebau added a reviewer: mart.
kossebau added a subscriber: plasma-devel.

Hmpf, did I not tell arc to not pick up the CMakeLists.txt change?

kossebau updated this revision to Diff 3250.Apr 10 2016, 2:10 AM

Remove accidentally commited CMakeLists.txt work adaptions

kossebau retitled this revision from Fix unsetting associated application/urls for applets to Fix unsetting associated application/urls for Plasma::Applets.Apr 11 2016, 8:47 PM
kossebau updated this object.
kossebau added a project: Plasma.

Backtrace I just got with my recent post 5.6.2 fix to the weather widget unsetting the urls with an empty QList<QUrls> (will have to workaround it seems and set some fallback url for now):

Thread 1 (Thread 0x7f13e16a08c0 (LWP 24002)):
[KCrash Handler]
#6 0x00007f13db42e562 in QUrl::scheme() const () at /usr/lib64/libQt5Core.so.5
#7 0x00007f13db54ef6e in QMimeDatabase::mimeTypeForUrl(QUrl const&) const () at /usr/lib64/libQt5Core.so.5
#8 0x00007f13df873487 in Plasma::AssociatedApplicationManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void) (this=0xf96a30) at /usr/src/debug/plasma-framework-5.20.0/src/plasma/private/associatedapplicationmanager.cpp:76
#9 0x00007f13df873487 in Plasma::AssociatedApplicationManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void
) (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/plasma-framework-5.20.0/build/src/plasma/moc_associatedapplicationmanager_p.cpp:75
#10 0x00007f13db500f0a in QMetaObject::activate(QObject*, int, int, void) () at /usr/lib64/libQt5Core.so.5
#11 0x00007f13ddc324aa in KSycocaPrivate::slotDatabaseChanged() () at /usr/lib64/libKF5Service.so.5
#12 0x00007f13db500d97 in QMetaObject::activate(QObject*, int, int, void
) () at /usr/lib64/libQt5Core.so.5
#13 0x00007f13dd525245 in KDirWatch::created(QString const&) () at /usr/lib64/libKF5CoreAddons.so.5
#14 0x00007f13dd525e32 in KDirWatch::setCreated(QString const&) () at /usr/lib64/libKF5CoreAddons.so.5
#15 0x00007f13db501cf9 in QObject::event(QEvent*) () at /usr/lib64/libQt5Core.so.5
#16 0x00007f13dc63787c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#17 0x00007f13dc63c986 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#18 0x00007f13db4d3c83 in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib64/libQt5Core.so.5
#19 0x00007f13db4d5fa6 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib64/libQt5Core.so.5
#20 0x00007f13db5270b3 in () at /usr/lib64/libQt5Core.so.5
#21 0x00007f13d73031a7 in g_main_context_dispatch () at /usr/lib64/libglib-2.0.so.0
#22 0x00007f13d73033d8 in () at /usr/lib64/libglib-2.0.so.0
#23 0x00007f13d730347c in g_main_context_iteration () at /usr/lib64/libglib-2.0.so.0
#24 0x00007f13db5274bf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#25 0x00007f13db4d15ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib64/libQt5Core.so.5
#26 0x00007f13db4d928d in QCoreApplication::exec() () at /usr/lib64/libQt5Core.so.5
#27 0x000000000041d964 in ()
#28 0x00007f13dab525b0 in __libc_start_main () at /lib64/libc.so.6
#29 0x000000000041da99 in _start ()

mart accepted this revision.Apr 11 2016, 8:56 PM
mart edited edge metadata.
This revision is now accepted and ready to land.Apr 11 2016, 8:56 PM
kossebau closed this revision.Apr 11 2016, 11:10 PM