Correct specified transitions between searchbox, url navigator, tabs and split views
ClosedPublic

Authored by anthonyfieroni on May 15 2017, 4:11 AM.

Details

Summary

It's instroduced in 6af0dad2eeba

Test Plan


All transitions between different Dolphin views looks correct.

Diff Detail

Repository
R318 Dolphin
Lint
Lint Skipped
Unit
Unit Tests Skipped
anthonyfieroni created this revision.May 15 2017, 4:11 AM
Restricted Application added subscribers: Dolphin, Konqueror. · View Herald TranscriptMay 15 2017, 4:11 AM
anthonyfieroni edited the test plan for this revision. (Show Details)May 15 2017, 4:18 AM
anthonyfieroni retitled this revision from Do not update split actions when they or the split view not present to Do not update split actions when they or the tab page not present.May 15 2017, 4:21 AM

How do I trigger the crash?

  1. Search (ctrl+f)
  2. Open new tab
  3. close opened tab

It should happend if only open tab then close it.

elvisangelaccio requested changes to this revision.May 15 2017, 6:52 PM

Ok then this is bug https://bugs.kde.org/show_bug.cgi?id=379135 and the regression is caused by 6af0dad2eeba.
Checking the pointer may fix some crashes but doesn't fix the underlying issue (what if the pointer is not zero but still invalid?)

This revision now requires changes to proceed.May 15 2017, 6:52 PM

I don't see how commit that you linked can interact to change tab index. http://doc.qt.io/qt-5/qtabwidget.html#widget widget(index) returns nullptr or valid pointer.

I don't see how commit that you linked can interact to change tab index. http://doc.qt.io/qt-5/qtabwidget.html#widget widget(index) returns nullptr or valid pointer.

Yeah I don't know either why. Can you can confirm that it doesn't crash anymore if you revert this commit?

I'm surprised to see that bug report before 17.04.1, i daily use searching, tabbing, splitting and i never experianced a crash before last update. I will investigate to determine why is not chacked in other places. After the patch, no crash happens.

anthonyfieroni edited edge metadata.
anthonyfieroni edited the summary of this revision. (Show Details)
anthonyfieroni edited the test plan for this revision. (Show Details)

Elvis, you are right. I revert 6af0dad2eeba, it's doing in other way. Calling viewContainer->setActive(false), whenever it's called after close tab (because close tab activate DolphinTabWidget::currentTabChanged, causing recursive stack smash or reading the removed index (stack trace).
I simplified the logic by removing DolphinViewContainer::activate, the problem is on closed tab KUrlNavigator or DolphinSearchBox reactivate the view (cause it's connected through DolphinViewContainer::activate). I don't see any reason KUrlNavigator, DolphinSearchBox and DolphinView to reactive itselfs.

elvisangelaccio requested changes to this revision.May 17 2017, 9:35 AM

Thanks, this is starting to look good. Please fix the inline issues.

src/dolphinmainwindow.cpp
926 ↗(On Diff #14718)

Not necessary, the new view container is already active (by definition).

src/dolphinviewcontainer.cpp
73 ↗(On Diff #14623)

Regression: open slit view and click the url navigator of the inactive view. This should toggle the active view but it doesn't anymore.

87 ↗(On Diff #14623)

Same regression. Open split view and open search box in both views. If you click the search box of the inactive view, the view no longer becomes active.

src/dolphinviewcontainer.h
245 ↗(On Diff #14623)

Don't remove this slot, we still need it (see below).

This revision now requires changes to proceed.May 17 2017, 9:35 AM
anthonyfieroni marked 3 inline comments as done.May 19 2017, 7:56 AM
anthonyfieroni added inline comments.
src/dolphinviewcontainer.h
245 ↗(On Diff #14623)

I'll do it in other way, this slot is *pure* evil, it should be removed

anthonyfieroni edited edge metadata.
anthonyfieroni retitled this revision from Do not update split actions when they or the tab page not present to Correct specified transitions between searchbox, url navigator, tabs and split views.
anthonyfieroni edited the test plan for this revision. (Show Details)

Complete removal of activate, this slot and connections to it, like KUrlNavigator or SearchBox is unwanted and makes infinite loop to view (true / false) cause when url is changed KUrlNavigator fire activate then viewchanged is fired in there view->setActive is called to false, now we enter an infinite loop.

elvisangelaccio requested changes to this revision.May 19 2017, 8:25 AM

I'm not convinced. How do I reproduce the infinite loop of signals/slots? (I tried to put some debug prints but everything seems fine).

I see another regression now:

  1. Open split view
  2. Open a new tab
  3. Go back to the old tab
  4. Right click doesn't work
This revision now requires changes to proceed.May 19 2017, 8:25 AM

Reproduce infinite loop:
Revert connections kurl navigator, searchbox to activate, open 2 tabs, return to first click bookmark in places (make sure you have other changes). The new regression is because focus is missing, if you click in the view, it works. I'll correct it.

anthonyfieroni edited edge metadata.

I *really* hate this code, but it works correct all the way. The situation is quite complicated between different tab views

elvisangelaccio requested changes to this revision.May 20 2017, 12:40 PM

There is still a small regression, unfortunately:

  1. Open split view
  2. Open search box in both views
  3. Click the search box of the inactive view
  4. Palette of the inactive view doesn't change
src/dolphinviewcontainer.cpp
609–614 ↗(On Diff #14710)

Why this change of behavior? If I click the file view I don't expect to get focus in the search box.

This revision now requires changes to proceed.May 20 2017, 12:40 PM
anthonyfieroni added inline comments.May 20 2017, 6:10 PM
src/dolphinviewcontainer.cpp
609–614 ↗(On Diff #14710)

We should not focus view when searchbox is enabled or we end-up with same crash.

anthonyfieroni edited edge metadata.

At least check for invalid index is better.

elvisangelaccio requested changes to this revision.May 21 2017, 9:23 AM
elvisangelaccio added inline comments.
src/dolphinmainwindow.cpp
1474–1476 ↗(On Diff #14718)

I still think that D5919 would be a better fix for https://bugs.kde.org/show_bug.cgi?id=379135

It is just wrong that DolphinTabWidget's widget(currentIndex()) returns nullptr if currentIndex() == 1 and count() == 2.

But the rest of this patch looks good as fix for https://bugs.kde.org/show_bug.cgi?id=380032

src/dolphintabpage.cpp
298 ↗(On Diff #14718)

Why active instead of m_active here? (if active is false, m_active would be true if split view is disabled)

src/dolphintabpage.h
133 ↗(On Diff #14718)

This is not a signal, so "notify" sounds wrong for this method. Let's use something like "Set whether the tab page is active".

This revision now requires changes to proceed.May 21 2017, 9:23 AM
src/dolphintabpage.cpp
298 ↗(On Diff #14718)

If split is disabled m_active bacame true, but we want view to goes from false to true, this will not happen we will have
setActive(m_active) true
next time setActive(m_active)
true again

src/dolphintabpage.cpp
298 ↗(On Diff #14718)

Ok, please add some comments because this could be confusing.

anthonyfieroni added inline comments.May 21 2017, 5:08 PM
src/dolphinmainwindow.cpp
1474–1476 ↗(On Diff #14718)

I saw the code in QTabWdiget, i think the problem is the quque looks like:
currentChanged
widgetRemoved
focusIn (searchbox)
real index changed
deleteLater (tabPage)
I'll change tabPage->deleteLater to delete tabPage, what you think?

src/dolphinmainwindow.cpp
1474–1476 ↗(On Diff #14718)

That's too late I think, the crash happens before removeTab() returns.

anthonyfieroni edited edge metadata.
elvisangelaccio accepted this revision.May 22 2017, 7:59 AM

Thanks! Looks good to me now.

Please don't forget to add:

BUG: 379135
BUG: 380032

in the commit message.

This revision is now accepted and ready to land.May 22 2017, 7:59 AM
This revision was automatically updated to reflect the committed changes.