GNOME Bugzilla – Bug 670928
Command line option for '--open-note' fails if Tomboy is already running
Last modified: 2012-10-08 23:56:11 UTC
If tomboy is NOT started already, using the --open-note flag works as expected. However, if it IS running, I now get: "Tomboy is already running. Exiting..." This used to work in the past, so I hope that means it's a relatively easy fix.
I believe there is different behavior on Windows than Linux for this too. It's a bug that I've seen before.
Created attachment 223189 [details] [review] Patch to fix "Command line option for '--open-note' fails if Tomboy is already running" This is caused by named mutexes which, since Mono 2.8 [1], work only if the MONO_ENABLE_SHM environment variable is set. This caused single instance detection not to work. Assuming this Mono decision was for a good reason, I decided to fix it using DBus. Patch attached. It works only if Tomboy is build with DBus support: Mac and Windows version might still have this problem (I can't test it since I only run Ubuntu). In that case we should probably set the MONO_ENABLE_SHM environment variable in the Windows and Mac build. To remove all these ifdef I would have loved to refactor the affected class (RemoteControlProxy), making it an interface with two classes implementing it. (Then using Services.cs/PlatformFactory.cs to instantiate it.) ..but again: I would have probably broken Windows and Mac support since I can't test it. [1] http://www.mono-project.com/Release_Notes_Mono_2.8#Shared_handles_are_disabled_by_default
Review of attachment 223189 [details] [review]: It appears good, but I don't really understand much of the code. For now I've applied the patch at https://github.com/trepidity/Tomboy
Interesting, unless things have changed since this commit [0] we should either explicitly set MONO_ENABLE_SHM, or merge something like Matteo's patch (which I haven't actually reviewed). [0] http://git.gnome.org/browse/tomboy/commit/Tomboy/tomboy.in?id=123677b19bf7cc54cf872c1ec0da2a544e0b0df2 I don't recall off the top of my head how single instance detection works on Mac, but Windows uses a different scheme for that and for the remote control calls (and also it uses MS.NET instead of Mono).
Review of attachment 223189 [details] [review]: After running in my branch I have now pushed it to tomboy master