Welcome, Guest. Please login or register.

Author Topic: Basic Amiga-API coding  (Read 11923 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Basic Amiga-API coding
« on: August 01, 2006, 07:10:06 PM »
@Kronos
Quote
Added chapter 4, basic menus.

It would crash less if you terminated the mymenu array with NM_END entry.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Basic Amiga-API coding
« Reply #1 on: August 08, 2006, 04:09:16 PM »
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.c

The example above truly allows unlimited number (limited only by the amount of free memory) windows per single process.