Changeset 6933 for trunk/src


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

prevent multiple delete actions for the same timer

Location:
trunk/src/winmm
Files:
3 edited

Legend:

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

    r5358 r6933  
    1 /* $Id: os2timer.cpp,v 1.18 2001-03-23 16:23:44 sandervl Exp $ */
     1/* $Id: os2timer.cpp,v 1.19 2001-10-03 13:47:58 sandervl Exp $ */
    22
    33/*
     
    225225OS2Timer::OS2Timer() : TimerSem(0), TimerHandle(0), hTimerThread(0),
    226226                  clientCallback(NULL), TimerStatus(Stopped), fFatal(FALSE),
    227                   next(NULL)
     227                  next(NULL), timerID(0)
    228228{
    229229  dprintf(("WINMM:OS2Timer: OS2Timer::OS2Timer(%08xh)\n",
     
    416416              {
    417417                selTIB = SetWin32TIB();
    418                 clientCallback((UINT)this, 0, userData, 0, 0);
     418                clientCallback((UINT)timerID, 0, userData, 0, 0);
    419419                SetFS(selTIB);
    420420              }
  • trunk/src/winmm/os2timer.h

    r6728 r6933  
    1 /* $Id: os2timer.h,v 1.10 2001-09-16 19:27:24 phaller Exp $ */
     1/* $Id: os2timer.h,v 1.11 2001-10-03 13:47:58 sandervl Exp $ */
    22
    33#ifndef __OS2TIMER_H__
     
    107107        void          KillTimer();
    108108
     109
     110        DWORD         getTimerID()         { return timerID; };
     111        void          setTimerID(DWORD id) { timerID = id; };
     112
    109113protected:
    110114
     
    120124        BOOL           fFatal;
    121125        int            TimerStatus;
     126        DWORD          timerID;
    122127        enum {
    123128                InActive = 0,
  • 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.