Example #1
0
	/// Run all currently active schedulers.
	/// If we're the only reference holder to a document, release the document and its scheduler
	void update( void )
	{
		SchedulerMap::iterator it = schedulers.begin();
		while( it != schedulers.end() ) {
			// grab the next pointer in case we erase the current one
			SchedulerMap::iterator next = it;
			next++;

			ElementDocument *doc = it->first;
			FunctionCallScheduler *scheduler = it->second;

			if( doc->GetReferenceCount() == 1 ) {
				scheduler->shutdown();
				__delete__( scheduler );

				doc->RemoveReference();

				schedulers.erase( it );
			}
			else {
				scheduler->update();
			}

			// advance
			it = next;
		}
	}
Example #2
0
	~ASWindow()
	{
		// detatch itself from the possibly opened modal window
		detachAsEventListener();

		// remove schedulers for all documents we hold references to
		for( SchedulerMap::iterator it = schedulers.begin(); it != schedulers.end(); it++ ) {
			ElementDocument *doc = it->first;
			FunctionCallScheduler *scheduler = it->second;

			doc->RemoveReference();
			scheduler->shutdown();
			__delete__( scheduler );
		}
		schedulers.clear();
	}