Hello,

1) This is firstly the DumbCuckoo outcome.

Several weeks ago, I finally understood why my Cuckoo was dumb after every new installation of my Desktop: the clue is that you must set Alsamixer and store its config before building gnustep/libs-gui. If not, NSSound will not be able to read sounds until you set Alsa and you rebuild the gnustep/libs-gui. Once I understood this, I got a working sound by setting always Alsa at the first stage. That was done.

2) The ununderstood Autorelease warning

And so I wanted to rework my little GNUstep testing app: TestCuckoo... It is also one of my numerous exercises to go on learning and practice GNUstep and Objective C.

It is working now, but there is still something I cannot understand and so I would not get bad habits creating apps with memory leaks issues.

When you run a GNUstep application: AutoreleasePool is self handled, is'nt it?
But when I execute some action, the console outputs this message:

patrick@pi500:~/SOURCES/TestCuckoo $ openapp ./TestCuckoo.app
2026-02-22 18:32:37.214 TestCuckoo[497704:497704] Path: /home/patrick/SOURCES/TestCuckoo/TestCuckoo.app/Resources/cuckoo.wav
2026-02-22 18:32:37.222 TestCuckoo[497704:497704] Playing sound...
2026-02-22 18:32:38.273 TestCuckoo[497704:497946] autorelease called without pool for object (0x7fff8c01ea30) of class GSCInlineString in thread <NSThread: 0x55560b2d1ce0>{name = (null), num = 497946}

The unexpected part begins from the keyword 'autorelease'.

Below, the code of the complete action method:

- (void) testCuckoo: (id)sender
{
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"cuckoo" ofType:@"wav"];
 NSLog(@"Path: %@", soundPath);
NSSound *cuckoo; cuckoo = [[NSSound alloc] initWithContentsOfFile:soundPath byReference:NO];
 if (!cuckoo) {
    NSLog(@"Failed to load sound!");
 } else {
    [cuckoo play];
    NSLog(@"Playing sound...");
 }
}

Facts:
- The sound is listened as expected just before the message "Playing sound..." is shown.
- Menu and button can run the action above.
- I did not added myself 'autorelease' explicit  statements.

So why this warning? What is lacking?
Where should I add explicit ones?

I joined also the complete project in the case the cause would be elsewhere in the code.
Context: Agnostep-Desktop with GNU runtime.
Libs-gui built from the branch: 'app-wrapper-open-url'.


<TestCuckoo.tar.gz>


Regards,
Patrick

--
Patrick Cardona - Pi500 - GNU/Linux aarch64 (Debian 13.3)
Xorg (1:7.7+24) - libcairo2 (1.18.4-1+rpt1 arm64) - Window Maker (0.96.0-4) GWorkspace (1.1.0 - 02 2025) - Theme: AGNOSTEP - Classic - MUA: GNUMail (1.4.0 - rev.947)

Attachment: TestCuckoo.tar.gz
Description: GNU Zip compressed data

Reply via email to