Bug 315767 - activeViewSpace() sometiems returns a wrong result
Summary: activeViewSpace() sometiems returns a wrong result
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: Git
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-25 20:20 UTC by Fabian
Modified: 2016-09-05 11:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian 2013-02-25 20:20:33 UTC
see e.g. https://bugs.kde.org/show_bug.cgi?id=315660

Reproducible: Always

Actual Results:  
activeViewSpace() returns a pointer to the wrong viewspace (we should check for a pattern)

Expected Results:  
it should always return the viewspace which is actually the active one
Comment 1 Fabian 2013-02-25 23:08:30 UTC
After some debugging I think this is due to activeViewSpace returning m_viewSpaceList.first() if no view space is marked as active. Now the more interseting question is why no viewspace is active. I'm still researching it.
Comment 2 Christoph Cullmann 2013-04-01 14:48:51 UTC
If you find some reason, patches are really welcome!
Comment 3 Fabian 2013-04-03 17:57:53 UTC
Status update: After more debugging, here's what I've found out:
After
parentSplitter->insertWidget (index, currentSplitter->widget (0));
in KateViewManager::removeViewSpace,
the activeViewSpace function reproducible returns a different value than before it. I'm not really sure why, and not even if the exact behaviour is deterministic, though the end result is always that a wrong value is returned.
@Chritstoph: Any idea what could cause this? I can't say that I really understand what the code is doing there.
Comment 4 Christoph Cullmann 2013-04-04 20:07:08 UTC
Hmm, I just look at the code, what means: wrong value? I mean, if the active viewspace is removed randomly one will be picked as new active.
Comment 5 Fabian 2013-04-04 20:34:59 UTC
If your comment is about comment #1: I can't reproduce that  behaviour anymore (at least not the way I reproduce the bug at the moment).
For what I'm doing now: I reverted commit 2e38699a04fc804b7619d0c48b6bea48b2dfa40f (which works around the issue), and reproduce the problem with the steps mentioned in Bug 315660 .

Wrong value in the context of closing the other views means that firstly activeViewSpace returns the correct, active viewspace. Then, after removing some view spaces (none of them being the active one), activeViewSpace returns a different value. IMHO, removing/deleting view spaces which are not active shouldn't change the active view space. I've described what (I think) happens in the mail to the mailing list.
Comment 6 Dominik Haumann 2013-08-13 15:37:54 UTC
http://lists.kde.org/?l=kwrite-devel&m=136507949428322 says: 

This is more or less what happens:
1) parentSplitter->insertWidget (index, currentSplitter->widget (0)) in KateViewManager::removeViewSpace, kateviewmanager.cpp gets called
2) which triggers KateViewManager::activateSpace, which sets the wrong viewspace to active.

2) gets called, because of
  connect(view, SIGNAL(focusIn(KTextEditor::View*)), this, SLOT(activateSpace(KTextEditor::View*))); in kateviewmanager.cpp, line 
416 as the focusIn signal is emmited
Comment 7 Christoph Cullmann 2016-09-05 11:41:16 UTC
Actually, I am not aware of problems caused by that, therefore, I think we just ignore this behavior.