Qalculate / qalculate-gtk

Qalculate! GTK+ UI
https://qalculate.github.io/
GNU General Public License v2.0
951 stars 70 forks source link

gdbus-nonce-file-[6 characters] created on each launch and never deleted #268

Open Gitoffthelawn opened 3 years ago

Gitoffthelawn commented 3 years ago

Hi! Thank you for creating Qalculate. I am new to the project, and am just getting a feel for it. Looks promising!

I'm testing the portable version for Windows on Win7. Every time qalculate.exe is launched, the file gdbus-nonce-file-[6 chars] gets created in the user's temp folder. The files are never deleted.

Thus, if you launch Qalculate twice an hour for 10 hours per day, you will wind up with 20 of these files in a day. After a month, that will be over 500 files!

Note that I reported a similar bug on another popular GTK project about a year ago, and they were able to "fix" it by manually deleting the file on exit. See https://github.com/bleachbit/bleachbit/issues/858 for that bug report, and https://github.com/bleachbit/bleachbit/commit/58abc3e0c76f6064ce37bde895be0b02581cd472 for the fix. A better solution would be ideal, but this fix is adequate.

Can this issue be resolved here?

hanna-kn commented 3 years ago

Deleting the file might interfere with other applications, e.g. if BleachBit is closed while Qalculate is running, Qalculate will lose instance communication (when Qalculate is launched a second time the previous instance will not be activated even if "allow multiple instances" is deactivated).

Gitoffthelawn commented 3 years ago

Interesting. Is there a good (but not too lengthy) description somewhere of the purpose of this file?

From what you wrote, it sounds like all apps using GTK share a common gdbus-nonce-file-[6 chars] file. Is that correct? Wait, that can't be correct, because every time Qalculate is run, a new gdbus-nonce-file-[6 chars] file is created. Or is it that BleachBit is deleting every gdbus-nonce-file-* file?

I'm hoping we can figure out a good solution together. It's hard to imagine that the GTK authors planned on littering the temp folder with hundreds of orphaned files.

hanna-kn commented 3 years ago

I've come up with a simple solution - remove all except the newest gdbus-nonce-file-* files on exit.

GTK apps share a common D-Bus server, used for inter process communication, which creates a gdbus-nonce-file each time it is run. Ideally gdbus.exe would remove the file on exit.