https://bugs.kde.org/show_bug.cgi?id=385916

Igor Kushnir <igor...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Version Fixed In|                            |6.2.250400
      Latest Commit|                            |https://invent.kde.org/kdev
                   |                            |elop/kdevelop/-/commit/90f2
                   |                            |a156da8d9f7eb1aa59df3fcf19e
                   |                            |da763dec3

--- Comment #7 from Igor Kushnir <igor...@gmail.com> ---
Git commit 90f2a156da8d9f7eb1aa59df3fcf19eda763dec3 by Igor Kushnir.
Committed on 10/02/2025 at 14:30.
Pushed by igorkushnir into branch 'master'.

Initialize KDevFileManagerPlugin synchronously

UiController::loadAllAreas() adds a tool view to a sublime area only if
the tool view is in the area's list of desired views. This list is
stored in ~/.config/kdeveloprc at the "desired views" key of the config
groups [User Interface][Main Window 0][Area <name>]. This configuration
preserves sets of tool views available in dock widget areas when the
user switches between sublime areas or restarts KDevelop.

UiController::addToolView() does not add to sublime areas but only
registers the tool view if called before loadAllAreas() returns. But if
addToolView() is called after loadAllAreas(), it adds the tool view to
all areas unconditionally.

KDevFileManagerPlugin() invokes KDevFileManagerPlugin::init()
asynchronously. init() adds the "File System" tool view via
IUiController::addToolView(). Consequently, this tool view is added
after loadAllAreas() returns on KDevelop start. And therefore the
"File System" tool view is always added at its default position when
KDevelop starts, whether or not the "desired views" config of the
current sublime area contains it. As a result, removing the
"File System" tool view and restarting KDevelop results in the tool view
reappearing in its default (left) dock widget area.

All other plugins, which add their tool views on KDevelop start, do so
synchronously. Therefore, tool views other than the "File System" do not
reappear on next KDevelop start after being removed. Remove
KDevFileManagerPlugin::init() and inline its definition into the single
invoking function KDevFileManagerPlugin() in order to add the
"File System" tool view synchronously and eliminate the bug.

KDevFileManagerPlugin::init() is invoked asynchronously since
e85e6380ab36c1bd53ee92fea11431bc6b26d6b7. The asynchronous loading
worked around a crash when the user enabled the "KDE File Manager
Integration" plugin on the Plugins tab of the Configure KDevelop dialog.
The crash occurred because in this scenario the plugin is loaded and
UiController::addToolView() is invoked long after KDevelop starts. So
addToolView() adds the "File System" tool view to all areas, which
creates a FileManager object, which in turn creates a BookmarkHandler
object, which in turn invokes Session::pluginDataArea(). All this
happened during the construction of KDevFileManagerPlugin(), that is
before its insertion into PluginController's list of loaded plugins.
Session::pluginDataArea() asked PluginController for the ID of
KDevFileManagerPlugin absent from the list of loaded plugins. This used
to crash before, but now returns an empty string as the plugin ID, and
thus silently makes BookmarkHandler use the wrong bookmarks path in this
scenario.

The function ISession::pluginDataArea() is used in the single place -
BookmarkHandler(), where it silently breaks the synchronous
initialization of KDevFileManagerPlugin. Replace the error-prone
function with a much simpler and reliable alternative
ISession::dataDirectory(). Hard-code the plugin ID "kdevfilemanager" in
BookmarkHandler() to eliminate the wrong bookmarks path bug. Spell out
and preserve the odd-looking long filename of the bookmarks path for
backward compatibility and explain it in a comment.

Remove no longer used KDevFileManagerPlugin* data members, getters and
constructor parameters, as well as includes and forward declarations.
FIXED-IN: 6.2.250400

M  +4    -3    kdevplatform/interfaces/isession.h
M  +3    -22   kdevplatform/shell/session.cpp
M  +1    -2    kdevplatform/shell/session.h
M  +6    -4    plugins/filemanager/bookmarkhandler.cpp
M  +2    -8    plugins/filemanager/filemanager.cpp
M  +1    -4    plugins/filemanager/filemanager.h
M  +4    -11   plugins/filemanager/kdevfilemanagerplugin.cpp
M  +0    -2    plugins/filemanager/kdevfilemanagerplugin.h

https://invent.kde.org/kdevelop/kdevelop/-/commit/90f2a156da8d9f7eb1aa59df3fcf19eda763dec3

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to