PLUGIN_API void Berkelium_destroy()
{
	--refCount;

	if(refCount == 0)
	{
		cerr << "Last reference to Berkelium destroyed: destroying the library" << endl;

		// Destroy the windows that still exist
		// Note: we update Berkelium after each destroy to ensure no messages are left in the message loop
		for(WindowMap::iterator it = windows.begin(); it != windows.end(); ++it)
		{
			delete it->second;
			Berkelium::update();
		}
		windows.clear();

		// Close the berkelium backend
		Berkelium::destroy();
		cerr << "... done destroying Berkelium" << endl;

		// Close the log file
		fclose(stderr);
	}
}
Example #2
0
void WindowMonitor::Stop() {
  sInitThread.join();
  SendMessage(GetLitestepWnd(), LM_UNREGISTERMESSAGE, (WPARAM)gWindow, (LPARAM)sWMMessages);
  KillTimer(gWindow, NCORE_TIMER_WINDOW_MAINTENANCE);
  sWindowData.clear();
  DestroyIcon(sDefaultIcon);
  sDefaultIcon = nullptr;
}
PLUGIN_API void Berkelium_destroy()
{
	--refCount;

	if(refCount == 0)
	{
		// Destroy the windows that still exist
		for(WindowMap::iterator it = windows.begin(); it != windows.end(); ++it)
			delete it->second;
		windows.clear();

		// Close the berkelium backend
		Berkelium::destroy();

		// Close the log file
		fclose(stderr);
	}
}