geany does not handle properly creating multiple times the same document

Bug #1482558 reported by Raúl Salinas-Monteagudo on 2015-08-07
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux Mint
geany (Ubuntu)

Bug Description

Distro: Linux Mint 17.1 Rebecca 64-bit

If you run geany on a non-existing file name twice, it will open two tabs, without realizing it will write to the same file.
You may then edit both documents separately and each time you save one of them, you will clobber the changes of the other document, so that the last save wins.

Just one of the tabs will realize that the document has changed in disk, if you additionally modify it from outside.

Basically to test it,
$ geany doc.txt & geany doc.txt &
* Write something in one tab and save.
* Write something in the other tab an save.

You lose forever the changes in the first tab, silently.

I think that geany could try to figure out the final destination of the saving, even if the file does not exist, and just select this tab.

To understand my scenario, I have a simple script for keeping a personal log that opens a file with the name of the current day. If I run it twice in a row before the file exists, I get multiple tabs for the same day, which turns out to be really inconvenient for me.

The problem might be a design limitation. The function document_find_by_real_path does not consider not-yet-existing files.

GeanyDocument* document_find_by_real_path(const gchar *realname)
        guint i;

        if (! realname)
                return NULL; /* file doesn't exist on disk */

Colomban Wendling (banw) wrote :
Changed in geany (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers