Emit errors when keditbookmarks is missing
ClosedPublic

Authored by valeriymalov on Jun 19 2017, 4:59 PM.

Details

Summary

KBookmarkManager::slotEditBookmarks is supposed to run keditbookmarks, but does not emit any errors when if it's missing
This makes "Edit bookmarks" menu fail silently in applications that use KBookmarks (e.g. krdc, konsole)

BUG: 303830

Diff Detail

Repository
R294 KBookmarks
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
valeriymalov created this revision.Jun 19 2017, 4:59 PM

This is not a comment about the content of the patch, but if it closed that bug, please change the reference to the bug with a simple line containing:

BUG: xxxxxx

valeriymalov edited the summary of this revision. (Show Details)Jun 19 2017, 5:03 PM
aacid added a subscriber: aacid.Jun 19 2017, 8:59 PM
aacid added inline comments.
src/kbookmarkmanager.cpp
330

You're leaking keditbookmarks

335

Have you checked errorString actually returns something?

Given startDetached is static it seems kind of weird it would update the "this" errorString

Call startDetached without an object since it's static (my bad, QProcess object does return an error but it's UnknownError and I assume should be seeing FailedToStart; there doesn't seem to be any other interesting errors so probably return value from startDetached should be enough)

valeriymalov marked 2 inline comments as done.Jun 19 2017, 9:37 PM
valeriymalov added inline comments.
src/kbookmarkmanager.cpp
335

Yeah it returns unknown error, my mistake, I suppose I should just switch back to call without object since it's a static method
There don't seem to be any informative errors apart from FailedToStart (which is the only one we are interested in?) in QProcess anyway

aacid added inline comments.Jun 19 2017, 9:58 PM
src/kbookmarkmanager.cpp
337

critical is a bit heavy in my opinion, i'd just go for warning for this and the debug line below.

341

Why const_cast?

valeriymalov marked an inline comment as done.Jun 19 2017, 10:52 PM
valeriymalov added inline comments.
src/kbookmarkmanager.cpp
341

Uh oh, I'd assume startKEditBookmarks should be const (which I forgot) since it doesn't change the object, yet we need to emit non-const singal error. So should it be const or not?

Also, I'm looking at slotEditBookmarks and slotEditBookmarksAtAddress, and don't understand why those weren't const, since they don't have side-effects too, although I might be missing something since I'm not too familiar with Qt.

aacid added inline comments.Jun 20 2017, 10:26 PM
src/kbookmarkmanager.cpp
341

i'd go for non const as the other two methods, yes they could be const since they're not modyfing the object, i guess what the original author had in mind is a meaning of "this changes things eventually" so that's why it isn't const, or maybe it was just a mistake :D

Toned down error from critical to warning, removed const cast

valeriymalov marked 2 inline comments as done.Jun 21 2017, 11:03 AM
dfaure accepted this revision.Jun 23 2017, 7:59 PM
dfaure added a subscriber: dfaure.

Good fix, thanks.

src/kbookmarkmanager.cpp
341

The author is me, and the calling methods are slots (which are typically not const) ;)

This revision is now accepted and ready to land.Jun 23 2017, 7:59 PM
This revision was automatically updated to reflect the committed changes.