[fpc-devel] simpleipc issues

Michael Van Canneyt michael at freepascal.org
Wed Nov 11 17:47:57 CET 2015

On Wed, 11 Nov 2015, Ondrej Pokorny wrote:

> On 29.09.2015 12:52, Michael Van Canneyt wrote:
>> Juha, if you want to implement the single IDE instance, then I would like 
>> to ask you to implement this in custapp.pp. This is useful functionality 
>> for all kinds of applications, and is since very long on my todo list.
> On 30.09.2015 18:50, Ondrej Pokorny wrote:
>> On 29.09.2015 22:47, Michael Van Canneyt wrote:
>>> Let's first see how Ondrej does it.
>> See the patch attached. A simple demo program is attached as well 
>> (SITest.lpr).
> Hello Michael,
> you asked for implementing "single instance" in custapp.pp. I did it and sent 
> a patch on Sept 28th. Did you have the time to check it and find eventual 
> issues?
> I am resending the patch against current trunk and a testing application.

Well, I had an uncommitted patch for custapp.pp at the time
(better non-options and multiple-options support), which made applying and testing quite difficult.
So I waited, but forgot about it.

I checked the patch and applied it, so people can try it.

I have several remarks:

a) Your TBaseSingleInstance class contains too many methods.
    It assumes you are using advancedipc.
    I suggest refactoring such a way that advancedipc is in the implementation section of the class.

    or introduce TAbstractSingleInstance as a parent of TBaseSingleInstance with the bare minimum of methods/properties.

b) There is no way to have TCustomApplication create a different singleinstance class, for 2 reasons:
   1. Your property is declared as TCustomSingleInstance.
      It should be TBaseSingleInstance (or TAbstractSingleInstance)
      That means that the 'enabled' property should be in TBaseSingleInstance or TAbstractSingleInstance.
   2. You create the instance as TCustomSingleInstance.Create in the constructor.
      It should be a function CreateSingleinstance : TCustomSingleInstance;

Can you have a look at these remarks ? If something is not clear, let me know.


More information about the fpc-devel mailing list