This Intuition5 example has some serious bugs in it, for example it FreeSignal()s a signal bit that is still in use. Also it makes system leak signal bits as it pokes a live msgport created by the system (intuition). This is
a big no-no. The code will also reference zeropage at while(im = GetMsg(windows[sNr]->UserPort) when the window closegadget has been hit: windows[sNr] = NULL; is done, but the loop is not terminated.
Finally, it's rather silly example as it will run out of signals anyway, as it in fact allocates TWO signals per window, and leaks every 2nd of them. It also has tons of warnings, which are easy to spot and fix with -Wall.
Edit: I will not rewrite it, but instead provide a link to my shared msgport example code:
sharedidcmp.cThe example above truly allows unlimited number (limited only by the amount of free memory) windows per single process.