Help please

Jonathan Coxhead jonathan at doves.demon.co.uk
Fri Dec 15 19:39:56 GMT 2000


On 15 Dec 00, Schaefer wrote,

 | Simon (and others?), you can access some examples I put together for the
 | same reason. They are rather rough translations from the examples in 'Wimp
 | programming for all' - so if you need more background look it up in that
 | book, if you can get hold of it.

   Nice job. Just spotted a bug though ... the function

void poll()
{
  os_error *err;
  wimp_event_no *reason;
  err = xwimp_poll(0, block, NULL, reason);
  switch(*reason)
  {
    case wimp_NULL_REASON_CODE:{
    	error("Dieses Programm tut noch nichts!");
    	quit=TRUE;
    }
    break;
  }
  
}

writes through an uninitialised pointer (|reason|), which can corrupt any 
memory location in the system. It should read

void poll()
{
  os_error *err;
  wimp_event_no reason;
  err = xwimp_poll(0, block, NULL, &reason);
  switch(reason)
  {
    case wimp_NULL_REASON_CODE:{
    	error("Dieses Programm tut noch nichts!");
    	quit=TRUE;
    }
    break;
  }
}

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-user mailing list