Bug 322686 - assert when changing view mode via "View Mode" menu, but not via toolbar
Summary: assert when changing view mode via "View Mode" menu, but not via toolbar
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-22 13:05 UTC by Jonathan Marten
Modified: 2014-01-09 13:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.12.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2013-07-22 13:05:45 UTC
Konqueror in the file bowsing mode crashes with an assert when File Size View is selected and then one of the icons/details/compact modes is selected again.

ASSERT: "modeName.endsWith("-viewmode")" in file /ws/trunk/kdebase/kdebaseapps/konqueror/src/konqmainwindow.cpp, line 1606

The code in question, added by commit e1428451 to fix bug 299020, says:

QString modeName = action->objectName();
Q_ASSERT(modeName.endsWith("-viewmode"));

When switching between these modes, though, the name appears to be set to "dolphinpart" (verified with a kDebug and with gdb).


Reproducible: Always

Steps to Reproduce:
1.  Open Konqueror in file browsing mode viewing a local directory.
2.  Select Menu bar - View - View Mode - File Size View
3.  Select Menu bar - View - View Mode - Icons

Actual Results:  
Assert crash after step 3.


Expected Results:  
No crash.
Comment 1 Dawit Alemayehu 2014-01-01 13:14:10 UTC
I cannot reproduce this no matter what I tried. I guess you have a viewmode whose action name does not end with "-viewmode". Can you add a debug statement just above the Q_ASSERT to see the actual action name that causes this? That is if you still hit this assert today.
Comment 2 Jonathan Marten 2014-01-08 13:52:25 UTC
Have done some more investigating and the crash depends on exactly how the mode is switched in the GUI.  It also does not necessarily involve File Size View, so have changed bug title to better reflect the cause.

Start Konqueror in file browsing mode, with toolbars visible.  Go to menu Settings - Configure Toolbars and select the "Dolphin Toolbar <dolphinpart>" toolbar, confirm that it contains three actions "Icons", "Compact" and "Details".

Switch between view modes using these three actions in the toolbar.  There is no crash.  Adding a kDebug() just before the assert indicates that slotViewModeTriggered() is *not* being called here.

Select "Compact", then go to menu View - View Mode.  Observe that the check state here may not reflect that actually shown in the view;  for example, on the first startup of Konqueror "Icons" is checked here even though the view mode was set to "Compact" above.

Select one of the "Icons", "Details" or "Compact" modes in this menu, crash.  Here slotViewModeTriggered() is called and the action name (for either of these 3 modes) is "dolphinpart".
Comment 3 Dawit Alemayehu 2014-01-09 11:04:11 UTC
I do see that the sync view mode menu items are not in sync with what is selected in the toolbar, but switching to any of the other view modes listed in that menu still does cause a crash for me. I will see if I can fix the out sync issue.
Comment 4 Jonathan Marten 2014-01-09 12:22:48 UTC
Patch that fixes the crash for me, and keeps the menu entries in sync, is at
https://git.reviewboard.kde.org/r/114924/
Comment 5 Dawit Alemayehu 2014-01-09 13:21:22 UTC
(In reply to comment #4)
> Patch that fixes the crash for me, and keeps the menu entries in sync, is at
> https://git.reviewboard.kde.org/r/114924/

That is one way to fix it, but the more simpler fix is to actually fix the part that David forgot to update when he committed the patch for another crash. See 

For the record, though I cannot reproduce the crash, I can see how you could hit that Q_ASSERT. Basically when actions for a service like the dolphinpart that provides several views, we do not append "-viewmode" to the objectname we use. Hence, when you change the view from the toolbar the checked action in the "View->View Mode" menu is never updated because the check in slotInternalViewModeChanged() only matches object names that end with "-viewmode". The fix is to append "-viewmode" to the object names.
Comment 6 Dawit Alemayehu 2014-01-09 13:22:00 UTC
Forgot the link in previous reply: https://git.reviewboard.kde.org/r/114926/
Comment 7 Dawit Alemayehu 2014-01-09 13:32:18 UTC
Git commit af5a796edddefb08f9d7c02068a6e891a327b25a by Dawit Alemayehu.
Committed on 09/01/2014 at 13:10.
Pushed by adawit into branch 'KDE/4.12'.

Append "-viewmode" to object name of actions associated with services that provide multiple views.
FIXED-IN: 4.12.1
REVIEW: 114926

M  +1    -1    konqueror/src/konqmainwindow.cpp

http://commits.kde.org/kde-baseapps/af5a796edddefb08f9d7c02068a6e891a327b25a