Bug 500399 - opening files from the command line opens new session
Summary: opening files from the command line opens new session
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Session support (other bugs)
Version First Reported In: 5.12.230805
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-19 12:30 UTC by Lars Winterfeld
Modified: 2025-02-24 17:30 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Winterfeld 2025-02-19 12:30:16 UTC
In KDevelop Version 5.7.211203 (21.12.3) it used to be the case that when a KDevelop session was already running and I run, e.g., "kdevelop *.h" from bash, it would open all *.h files in the currently running KDevelop session and basically add the files to the list of open files.

Now, in Version 5.12.230805 (23.08.5), when I do the same, it opens a new KDevelop window, seemingly a new session and says that the Cache is unclean ("The previous session crashed. The crash may be caused by a corruption of cached data. Press Clear if you want KDevelop to clear the cache, otherwise press Continue if you are sure the crash has another origin."). Cleaning the cache, however, can cause the already open session to crash.

I would like to have the old behavior back or have a command line option to indicate that I want the files to be opened in the current session.
Comment 1 Igor Kushnir 2025-02-20 10:09:28 UTC
Cannot reproduce in the almost latest KDevelop master (version 6.2.250370). When a single KDevelop session is open, the files opened from the command line are added to it. When multiple KDevelop sessions are open, the "Pick a Session" dialog allows to choose in which session to open the files.

KDevelop 5 is no longer supported. I guess something is wrong with the interprocess communication to the running KDevelop instance(s) on your system. When you run kdevelop from the command line without any arguments, is the existing KDevelop window activated or a new one opened?
Comment 2 Lars Winterfeld 2025-02-20 11:18:18 UTC
When I run kdevelop from the command line without any arguments, a new window opened.

But: Thanks for the hint regarding the interprocess communication. It turns out the problem occurs only in a VNC session, but not out of it! So, kdevelop may be innocent.

I have an env var
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
Which seems ok? Any hint on which direction to look at to debug this would be highly appreciated.
Comment 3 Igor Kushnir 2025-02-20 13:32:19 UTC
(In reply to Lars Winterfeld from comment #2)
> I have an env var
> DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
> Which seems ok? Any hint on which direction to look at to debug this would
> be highly appreciated.
Debug KDevelop or analyze the source code. I guess getRunningSessionPid() called from main() in app/main.cpp returns -1, because it fails to detect a running KDevelop session. And that is probably because SessionController::isSessionRunning() returns false for the running session's ID, which must be caused by a wrong result of SessionLock::tryLockSession().
Comment 4 Igor Kushnir 2025-02-24 17:30:24 UTC
Resolving for now. Feel free to reopen with more info if you learn that the bug is in KDevelop code.