Remove the Undo closed window entry from the manager before opening the closed window
Review Request #114780 - Created Jan. 1, 2014 and submitted
This patch fixes part of a problem that was causing Konqueror to crash when undo'ing a previously closed window. The actual cause of the crash is the restored window was not removed from KonqClosedWindowsManager before it was restored. As a result, the "Undo: Closed Window" action was enabled under the edit menu even when there was no window other closed window! The reason this happens is because the current action that is being undone was note removed from the undo manager before the action itself was carried out. Hence, when the closed window starts it checks and see there was a window closed before (itself) that can be restored and hence enables the "Edit->Undo:..." menu. With this fix, the reopened window will not longer show that there is another Undo action when there isn't one. On a related note I have already fixed the actual place where the crash was happening as a result of this bug, KIO::FileUndoManager::undo. Though it was not the source of the crash, that code should not invoke first/last on a list without first checking for empty.
1. Close all Konqueror instances. 2. Remove the [Undo] section from konquerorrc. 3. Launch Konqueror and visit a site or browse a directory. 4. Close it. 5. Launch it again and click on Edit->Undo: Closed Window. 6. In the new Konqueror window that is opened with the site or directory you last visited, repeat step #5. Step #6 should result in a crash.