Ignore:
Timestamp:
Oct 3, 2001, 3:47:59 PM (24 years ago)
Author:
sandervl
Message:

prevent multiple delete actions for the same timer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/winmm/time.cpp

    r6728 r6933  
    1 /* $Id: time.cpp,v 1.13 2001-09-16 19:27:25 phaller Exp $ */
     1/* $Id: time.cpp,v 1.14 2001-10-03 13:47:59 sandervl Exp $ */
    22
    33/*
     
    1818#include <odinwrap.h>
    1919#include <misc.h>
     20#include <handlemanager.h>
    2021
    2122#include "os2timer.h"
     
    138139              UINT,     IDEvent)
    139140{
    140   dprintf(("WINMM:timeKillEvent\n"));
    141 
     141  OS2Timer *os2timer = NULL;
     142
     143  if(HMHandleTranslateToOS2(IDEvent, (PULONG)&os2timer) != NO_ERROR) {
     144      dprintf(("invalid timer id"));
     145      return TIMERR_NOERROR; //TODO: should we return an error here??
     146  }
     147  HMHandleFree(IDEvent);
    142148  // return OS2Timer::killEvent(UINT IDEvent)
    143149
    144   delete((OS2Timer *)IDEvent);
     150  delete os2timer;
    145151  return TIMERR_NOERROR;
    146152}
     
    167173{
    168174  OS2Timer *timer;
     175  ULONG     timerID = 0;
    169176
    170177// @@@PH 1999/10/26 hack for RA95
     
    200207      return(0);
    201208
     209  if(HMHandleAllocate(&timerID, (ULONG)timer) != NO_ERROR) {
     210      dprintf(("HMHandleAllocate failed!!"));
     211      delete timer;
     212      return 0;
     213  }
     214
     215  timer->setTimerID(timerID);
    202216  if(timer->StartTimer(wDelay, wResolution, lptc, dwUser, fuEvent) == FALSE)
    203217  {
     
    206220    return(0);
    207221  }
    208   return(MMRESULT)timer;
     222  return(MMRESULT)timerID;
    209223}
    210224
Note: See TracChangeset for help on using the changeset viewer.