Bug 360490 - Crash after closing "DCC status" tab
Summary: Crash after closing "DCC status" tab
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: dcc (show other bugs)
Version: 1.6
Platform: Chakra Linux
: NOR crash
Target Milestone: ---
Assignee: Bernd Buschinski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-13 19:19 UTC by Lisa
Modified: 2016-05-09 08:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Backtrace (13.60 KB, text/plain)
2016-03-17 23:15 UTC, Fabian
Details
Quick patch to circumvent crashes (1.76 KB, patch)
2016-05-04 23:42 UTC, Lisa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lisa 2016-03-13 19:19:41 UTC
To reproduce, send a file to a user. A new "DCC status" tab will open with the related information. If you right click on the tab and click Close, konversation segfaults. The regular log only shows a description of the content of the tab and then Segmentation fault.

The tab itself works fine, this happens regardless of other operations I do there (e.g. aborting a send).

Reproducible: Always

Steps to Reproduce:
1. Send a file to a user.
2. Close the "DCC status" tab.

Actual Results:  
Segmentation fault.

Expected Results:  
The tab closes and konversation keeps going.
Comment 1 Fabian 2016-03-17 23:15:43 UTC
Created attachment 97952 [details]
Backtrace

The above backtrace was captured when the bug occurred. The issue is that m_popupViewIndex is 2, but m_tabWidget->count() is 1. Therefore,
ChatWindow* view = static_cast<ChatWindow*>(m_tabWidget->widget(index));
will return a nullptr. The nullptr is then dereferenced in
if (view->isTopLevelView() && index > 0)
leading to a segfault.
Comment 2 Lisa 2016-05-04 23:42:30 UTC
Created attachment 98777 [details]
Quick patch to circumvent crashes
Comment 3 Lisa 2016-05-04 23:42:59 UTC
The discrepancy originates at one of the calls to removeTab (likely the one inside closeDccPanel) and m_popupViewIndex is never updated, so it becomes out of bounds.

I attached a patch that works both as a quick fix for this crash and as a "safe default" in the general case: canMoveView{Left,Right} detect the invalid pointer and return "false", causing the view to shift to the first tab in the list rather than to the adjacent one. A minor annoyance compared to the crash.

It is not the "proper" fix to this issue though, so I'll leave to the owners the decision on what to do with it.
Comment 4 Eike Hein 2016-05-09 08:43:05 UTC
Git commit 6130f4f0501f4e9db56619317f07e2f637160505 by Eike Hein.
Committed on 09/05/2016 at 08:42.
Pushed by hein into branch '1.6'.

Don't crash when closing the DCC Status tab.

M  +8    -1    src/viewer/viewcontainer.cpp

http://commits.kde.org/konversation/6130f4f0501f4e9db56619317f07e2f637160505