mate-desktop / caja

Caja, the file manager for the MATE desktop
https://mate-desktop.org/
Other
263 stars 144 forks source link

Endless loop #821

Open TomaszGasior opened 7 years ago

TomaszGasior commented 7 years ago

Actual behaviour

When I have these settings set in dconf:

and when I start new session with MATE desktop my CPU is loaded in 100%. It is because combination of these settings causes that Caja starts as deamon and immediately exists in endless loop.

MATE general version

1.18.0

Package version

caja 1.18.3

Linux Distribution

Arch Linux

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/47758286-endless-loop?utm_campaign=plugin&utm_content=tracker%2F651521&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F651521&utm_medium=issues&utm_source=github).
lukefromdc commented 7 years ago

Assuming you want Caja to not manage the desktop and not run as a daemon, you need to open dconf-editor and go to org>mate>desktop>session>required components and replace "caja" with an empty string in "filemanager" so Caja is not opened by the session and can be manually opened by the user instead. Then it can be opened with a directory, not manage the desktop, and close with the last window with these settings.

This is actually an old issue with how mate-session-manager and caja relate to oneanother. Caja normally opens with a -restart paramenter passed to the session manage. This is why if Caja crashes it immediately comes back up rather than having to be manually restarted.

OK, the desktop icons are a window of caja. Normally, exit with last window would not close caja so long as the desktop is showing, but without the desktop showing exit-with-last-window closes caja. having closed, the session then immediatly reopens it, and it closes again, and the loop continues.

To fix this would require that restart not be passed to the session manager if this combination of preferences is set. This actually cannot be easily done with the GtkApplication system that now manages caja (since 1.18) because that parameter has to passed to the session management client prior to the point where the gsettings preferences can be read. This required the code for preventing restart loops on a root instance of caja to be changed to not connect to the session manager at all. What could have been done in libunique is not always so easy now that libunique has been deprecated.

Detecting this pair of preferences and blocking restart be of little use, however except to block the accidental endless loop. It would cause caja to open and immediately close with every new session, while changing the session required components prevents both the restart loop and intiial opening.followed by that immediate close.

sc0w commented 6 years ago

with

/org/mate/caja/preferences/exit-with-last-window --> TRUE
/org/mate/desktop/background/show-desktop-icons --> FALSE

and, without restarting the session, if I close all caja windows, and I go in panel to "Places" -> "any folder" I see:

settingscaja

and caja can't load

(caja 1.18.4)

we have in/src/caja-application.c: CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW and MATE_BG_KEY_SHOW_DESKTOP

EDIT: forget this comment, I explain me in the next comment

lukefromdc commented 6 years ago

I can only think of one type of fix that would actually work: either ignore (disable) exit-with-last-window=TRUE if show-desktop-icons=FALSE and caja is started by the session., or ignore show-desktop-icons=FALSE when disable exit-with-last-window=TRUE and caja was started by the session manager, or simply ignore exit-with-last-window=TRUE anytime caja is started by the session manager. I did not do any of these in the original GtkApplication port because any of these is a behavior change from how Caja 1.14 and earlier (this was during 1.15) behaved.

Should I submit a PR to ignore exit-with-last-window=TRUE anytime caja is started by the session manager? Exit-with-last-window does not make sense if the session manager will force a restart anyway, and Caja can be removed from the list of required components if it is not to be started with the session but manually on demand (thus permitting this pair of options to be used without creating the loop).

sc0w commented 6 years ago

Forget my previous comment, it was happen because I didn't have enough disk space, probably it try to write some log file, and shows the error

I fixed the disk space, and now caja can open with that gsetting keys