Skip to content

Commit

Permalink
[VM] Make sure the virtual machine is eventually started
Browse files Browse the repository at this point in the history
Much code depends on it being actually started, even if only just before
closing the plugin.
  • Loading branch information
alexp-sssup committed Oct 28, 2012
1 parent 1d69be8 commit 0e6557f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/scripting/abc.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ friend class method_info;
bool addEvent(_NR<EventDispatcher>,_R<Event> ) DLL_PUBLIC;
int getEventQueueSize();
void shutdown();
bool hasEverStarted() const { return status!=CREATED; }

static Global* getGlobalScope(call_context* th);
static bool strictEqualImpl(ASObject*, ASObject*);
Expand Down
7 changes: 7 additions & 0 deletions src/swf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,14 @@ void SystemState::destroy()
renderThread->wait();
inputThread->wait();
if(currentVm)
{
//If the VM exists it MUST be started to flush pending events.
//In some cases it will not be started by regular means, if so
//we will start it here.
if(!currentVm->hasEverStarted())
currentVm->start();
currentVm->shutdown();
}

l.release();

Expand Down

0 comments on commit 0e6557f

Please sign in to comment.