Main.cxx 15.9 KB
Newer Older
1
/*
2
 * Copyright 2003-2016 The Music Player Daemon Project
3
 * http://www.musicpd.org
Warren Dukes's avatar
Warren Dukes committed
4 5 6 7 8 9 10 11 12 13
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
14 15 16 17
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Warren Dukes's avatar
Warren Dukes committed
18 19
 */

20
#include "config.h"
Max Kellermann's avatar
Max Kellermann committed
21
#include "Main.hxx"
22
#include "Instance.hxx"
Max Kellermann's avatar
Max Kellermann committed
23
#include "CommandLine.hxx"
Max Kellermann's avatar
Max Kellermann committed
24
#include "PlaylistFile.hxx"
25
#include "MusicChunk.hxx"
26
#include "StateFile.hxx"
27
#include "player/Thread.hxx"
Max Kellermann's avatar
Max Kellermann committed
28
#include "Mapper.hxx"
29
#include "Permission.hxx"
Max Kellermann's avatar
Max Kellermann committed
30
#include "Listen.hxx"
31 32
#include "client/Client.hxx"
#include "client/ClientList.hxx"
33
#include "command/AllCommands.hxx"
34
#include "Partition.hxx"
35
#include "tag/TagConfig.hxx"
36
#include "ReplayGainConfig.hxx"
Max Kellermann's avatar
Max Kellermann committed
37
#include "Idle.hxx"
38
#include "Log.hxx"
39
#include "LogInit.hxx"
Max Kellermann's avatar
Max Kellermann committed
40
#include "input/Init.hxx"
41
#include "event/Loop.hxx"
42
#include "IOThread.hxx"
43
#include "fs/AllocatedPath.hxx"
44
#include "fs/Config.hxx"
45
#include "playlist/PlaylistRegistry.hxx"
46
#include "zeroconf/ZeroconfGlue.hxx"
47
#include "decoder/DecoderList.hxx"
48
#include "AudioConfig.hxx"
49
#include "pcm/PcmConvert.hxx"
50
#include "unix/SignalHandlers.hxx"
51
#include "system/FatalError.hxx"
52
#include "util/Error.hxx"
53
#include "thread/Slack.hxx"
54
#include "lib/icu/Init.hxx"
55
#include "config/ConfigGlobal.hxx"
56
#include "config/Param.hxx"
57 58
#include "config/ConfigDefaults.hxx"
#include "config/ConfigOption.hxx"
59
#include "config/ConfigError.hxx"
60
#include "Stats.hxx"
Max Kellermann's avatar
Max Kellermann committed
61

62 63 64 65
#ifdef ENABLE_DAEMON
#include "unix/Daemon.hxx"
#endif

66 67
#ifdef ENABLE_DATABASE
#include "db/update/Service.hxx"
68
#include "db/Configured.hxx"
69
#include "db/DatabasePlugin.hxx"
70
#include "db/plugins/simple/SimpleDatabasePlugin.hxx"
71
#include "storage/Configured.hxx"
72
#include "storage/CompositeStorage.hxx"
73 74 75
#ifdef ENABLE_INOTIFY
#include "db/update/InotifyUpdate.hxx"
#endif
76 77
#endif

78 79 80 81
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Glue.hxx"
#endif

82
#ifdef ENABLE_SQLITE
83
#include "sticker/StickerDatabase.hxx"
84 85
#endif

86
#ifdef ENABLE_ARCHIVE
87
#include "archive/ArchiveList.hxx"
88
#endif
Max Kellermann's avatar
Max Kellermann committed
89

Max Kellermann's avatar
Max Kellermann committed
90
#ifdef ANDROID
91 92
#include "java/Global.hxx"
#include "java/File.hxx"
93
#include "android/Environment.hxx"
94
#include "android/Context.hxx"
95
#include "fs/StandardDirectory.hxx"
96
#include "fs/FileSystem.hxx"
Max Kellermann's avatar
Max Kellermann committed
97 98 99
#include "org_musicpd_Bridge.h"
#endif

100 101 102 103
#ifdef ENABLE_SYSTEMD_DAEMON
#include <systemd/sd-daemon.h>
#endif

Max Kellermann's avatar
Max Kellermann committed
104
#include <stdlib.h>
105

106
#ifdef HAVE_LOCALE_H
107 108 109
#include <locale.h>
#endif

110 111 112 113 114
#ifdef WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif

115
#ifdef __BLOCKS__
116 117 118
#include <dispatch/dispatch.h>
#endif

119 120
#include <limits.h>

121
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
122
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
Max Kellermann's avatar
Max Kellermann committed
123

124 125 126 127
#ifdef ANDROID
Context *context;
#endif

128
Instance *instance;
129

130
#ifdef ENABLE_DAEMON
131

132
static bool
133
glue_daemonize_init(const struct options *options, Error &error)
134
{
135
	auto pid_file = config_get_path(ConfigOption::PID_FILE, error);
136
	if (pid_file.IsNull() && error.IsDefined())
137 138
		return false;

139 140
	daemonize_init(config_get_string(ConfigOption::USER, nullptr),
		       config_get_string(ConfigOption::GROUP, nullptr),
141
		       std::move(pid_file));
142 143 144

	if (options->kill)
		daemonize_kill();
145 146

	return true;
147 148
}

149 150
#endif

151
static bool
152
glue_mapper_init(Error &error)
153
{
154
	auto playlist_dir = config_get_path(ConfigOption::PLAYLIST_DIR, error);
155
	if (playlist_dir.IsNull() && error.IsDefined())
156
		return false;
157

158 159 160
	mapper_init(std::move(playlist_dir));
	return true;
}
161

162 163
#ifdef ENABLE_DATABASE

164 165 166
static bool
InitStorage(Error &error)
{
167
	Storage *storage = CreateConfiguredStorage(io_thread_get(), error);
168 169 170 171 172 173 174 175 176
	if (storage == nullptr)
		return !error.IsDefined();

	assert(!error.IsDefined());

	CompositeStorage *composite = new CompositeStorage();
	instance->storage = composite;
	composite->Mount("", storage);
	return true;
177 178
}

179 180 181 182 183 184
/**
 * Returns the database.  If this function returns false, this has not
 * succeeded, and the caller should create the database after the
 * process has been daemonized.
 */
static bool
185
glue_db_init_and_load(void)
186
{
187
	Error error;
188
	instance->database =
189
		CreateConfiguredDatabase(instance->event_loop, *instance,
190
					 error);
191 192 193 194 195 196
	if (instance->database == nullptr) {
		if (error.IsDefined())
			FatalError(error);
		else
			return true;
	}
197

198 199 200
	if (instance->database->GetPlugin().flags & DatabasePlugin::FLAG_REQUIRE_STORAGE) {
		if (!InitStorage(error))
			FatalError(error);
201

202 203 204 205 206 207 208 209 210 211 212 213 214
		if (instance->storage == nullptr) {
			delete instance->database;
			instance->database = nullptr;
			LogDefault(config_domain,
				   "Found database setting without "
				   "music_directory - disabling database");
			return true;
		}
	} else {
		if (IsStorageConfigured())
			LogDefault(config_domain,
				   "Ignoring the storage configuration "
				   "because the database does not need it");
215 216
	}

217
	instance->database->Open();
218

219
	if (!instance->database->IsPlugin(simple_db_plugin))
220 221
		return true;

222
	SimpleDatabase &db = *(SimpleDatabase *)instance->database;
223
	instance->update = new UpdateService(instance->event_loop, db,
Max Kellermann's avatar
Max Kellermann committed
224
					     static_cast<CompositeStorage &>(*instance->storage),
225
					     *instance);
226

227
	/* run database update after daemonization? */
228
	return db.FileExists();
Warren Dukes's avatar
Warren Dukes committed
229
}
Warren Dukes's avatar
Warren Dukes committed
230

231 232 233 234 235 236 237
static bool
InitDatabaseAndStorage()
{
	const bool create_db = !glue_db_init_and_load();
	return create_db;
}

238 239
#endif

240 241 242 243 244 245 246
/**
 * Configure and initialize the sticker subsystem.
 */
static void
glue_sticker_init(void)
{
#ifdef ENABLE_SQLITE
247
	Error error;
248
	auto sticker_file = config_get_path(ConfigOption::STICKER_FILE, error);
249 250 251 252 253
	if (sticker_file.IsNull()) {
		if (error.IsDefined())
			FatalError(error);
		return;
	}
254

255
	if (!sticker_global_init(std::move(sticker_file), error))
256
		FatalError(error);
257 258 259
#endif
}

260
static bool
261
glue_state_file_init(Error &error)
262
{
263
	auto path_fs = config_get_path(ConfigOption::STATE_FILE, error);
264 265 266 267 268 269 270 271 272 273 274 275 276 277
	if (path_fs.IsNull()) {
		if (error.IsDefined())
			return false;

#ifdef ANDROID
		const auto cache_dir = GetUserCacheDir();
		if (cache_dir.IsNull())
			return true;

		path_fs = AllocatedPath::Build(cache_dir, "state");
#else
		return true;
#endif
	}
278

279 280 281
	const unsigned interval =
		config_get_unsigned(ConfigOption::STATE_FILE_INTERVAL,
				    StateFile::DEFAULT_INTERVAL);
282

283 284 285 286
	instance->state_file = new StateFile(std::move(path_fs), interval,
					     *instance->partition,
					     instance->event_loop);
	instance->state_file->Read();
287
	return true;
288 289
}

290 291 292 293 294
/**
 * Windows-only initialization of the Winsock2 library.
 */
static void winsock_init(void)
{
295
#ifdef WIN32
296 297
	WSADATA sockinfo;

298
	int retval = WSAStartup(MAKEWORD(2, 2), &sockinfo);
299
	if(retval != 0)
300 301
		FormatFatalError("Attempt to open Winsock2 failed; error code %d",
				 retval);
302 303

	if (LOBYTE(sockinfo.wVersion) != 2)
304 305
		FatalError("We use Winsock2 but your version is either too new "
			   "or old; please install Winsock 2.x");
306
#endif
307
}
308

Max Kellermann's avatar
Max Kellermann committed
309 310 311 312 313 314
/**
 * Initialize the decoder and player core, including the music pipe.
 */
static void
initialize_decoder_and_player(void)
{
315
	const struct config_param *param;
Max Kellermann's avatar
Max Kellermann committed
316

317
	size_t buffer_size;
318
	param = config_get_param(ConfigOption::AUDIO_BUFFER_SIZE);
319
	if (param != nullptr) {
320
		char *test;
321
		long tmp = strtol(param->value.c_str(), &test, 10);
322
		if (*test != '\0' || tmp <= 0 || tmp == LONG_MAX)
323 324
			FormatFatalError("buffer size \"%s\" is not a "
					 "positive integer, line %i",
325
					 param->value.c_str(), param->line);
326
		buffer_size = tmp;
Max Kellermann's avatar
Max Kellermann committed
327 328 329 330 331
	} else
		buffer_size = DEFAULT_BUFFER_SIZE;

	buffer_size *= 1024;

332
	const unsigned buffered_chunks = buffer_size / CHUNK_SIZE;
Max Kellermann's avatar
Max Kellermann committed
333 334

	if (buffered_chunks >= 1 << 15)
335 336
		FormatFatalError("buffer size \"%lu\" is too big",
				 (unsigned long)buffer_size);
Max Kellermann's avatar
Max Kellermann committed
337

338
	float perc;
339
	param = config_get_param(ConfigOption::BUFFER_BEFORE_PLAY);
340
	if (param != nullptr) {
341
		char *test;
342
		perc = strtod(param->value.c_str(), &test);
Max Kellermann's avatar
Max Kellermann committed
343
		if (*test != '%' || perc < 0 || perc > 100) {
344 345 346
			FormatFatalError("buffered before play \"%s\" is not "
					 "a positive percentage and less "
					 "than 100 percent, line %i",
347
					 param->value.c_str(), param->line);
Max Kellermann's avatar
Max Kellermann committed
348 349 350 351
		}
	} else
		perc = DEFAULT_BUFFER_BEFORE_PLAY;

352
	unsigned buffered_before_play = (perc / 100) * buffered_chunks;
Max Kellermann's avatar
Max Kellermann committed
353 354 355
	if (buffered_before_play > buffered_chunks)
		buffered_before_play = buffered_chunks;

356
	const unsigned max_length =
357
		config_get_positive(ConfigOption::MAX_PLAYLIST_LENGTH,
358 359
				    DEFAULT_PLAYLIST_MAX_LENGTH);

360 361 362 363
	instance->partition = new Partition(*instance,
					    max_length,
					    buffered_chunks,
					    buffered_before_play);
Max Kellermann's avatar
Max Kellermann committed
364 365
}

366 367
void
Instance::OnIdle(unsigned flags)
368
{
Max Kellermann's avatar
Max Kellermann committed
369
	/* send "idle" notifications to all subscribed
370
	   clients */
371
	client_list->IdleAdd(flags);
372

373
	if (flags & (IDLE_PLAYLIST|IDLE_PLAYER|IDLE_MIXER|IDLE_OUTPUT) &&
374 375
	    state_file != nullptr)
		state_file->CheckModified();
376 377
}

Max Kellermann's avatar
Max Kellermann committed
378 379
#ifndef ANDROID

380
int main(int argc, char *argv[])
381 382 383 384 385 386 387 388
{
#ifdef WIN32
	return win32_main(argc, argv);
#else
	return mpd_main(argc, argv);
#endif
}

Max Kellermann's avatar
Max Kellermann committed
389 390
#endif

391 392
static int mpd_main_after_fork(struct options);

393 394 395
#ifdef ANDROID
static inline
#endif
396
int mpd_main(int argc, char *argv[])
397
{
Max Kellermann's avatar
Max Kellermann committed
398
	struct options options;
399
	Error error;
Warren Dukes's avatar
Warren Dukes committed
400

401
#ifdef ENABLE_DAEMON
402
	daemonize_close_stdin();
403
#endif
404

405
#ifndef ANDROID
406
#ifdef HAVE_LOCALE_H
407 408
	/* initialize locale */
	setlocale(LC_CTYPE,"");
409
	setlocale(LC_COLLATE, "");
410
#endif
411
#endif
Max Kellermann's avatar
Max Kellermann committed
412

413
	if (!IcuInit(error)) {
414 415 416 417
		LogError(error);
		return EXIT_FAILURE;
	}

418
	winsock_init();
419
	io_thread_init();
420
	config_global_init();
Warren Dukes's avatar
Warren Dukes committed
421

422
	try {
423
#ifdef ANDROID
424 425
		(void)argc;
		(void)argv;
426

427 428 429 430
		const auto sdcard = Environment::getExternalStorageDirectory();
		if (!sdcard.IsNull()) {
			const auto config_path =
				AllocatedPath::Build(sdcard, "mpd.conf");
431 432
			if (FileExists(config_path))
				ReadConfigFile(config_path);
433
		}
434
#else
435 436 437 438 439 440 441
		if (!parse_cmdline(argc, argv, &options, error)) {
			LogError(error);
			return EXIT_FAILURE;
		}
#endif
	} catch (const std::exception &e) {
		LogError(e);
442 443
		return EXIT_FAILURE;
	}
Warren Dukes's avatar
Warren Dukes committed
444

445
#ifdef ENABLE_DAEMON
446
	if (!glue_daemonize_init(&options, error)) {
447
		LogError(error);
448 449
		return EXIT_FAILURE;
	}
450
#endif
451

Max Kellermann's avatar
Max Kellermann committed
452
	stats_global_init();
453
	TagLoadConfig();
454

455
	if (!log_init(options.verbose, options.log_stderr, error)) {
456
		LogError(error);
457 458
		return EXIT_FAILURE;
	}
459

460 461
	instance = new Instance();

462 463
#ifdef ENABLE_NEIGHBOR_PLUGINS
	instance->neighbors = new NeighborGlue();
464
	instance->neighbors->Init(io_thread_get(), *instance);
465 466 467 468 469 470 471

	if (instance->neighbors->IsEmpty()) {
		delete instance->neighbors;
		instance->neighbors = nullptr;
	}
#endif

472 473
	const unsigned max_clients =
		config_get_positive(ConfigOption::MAX_CONN, 10);
474
	instance->client_list = new ClientList(max_clients);
475

476 477
	initialize_decoder_and_player();

478
	if (!listen_global_init(instance->event_loop, *instance->partition,
479
				error)) {
480
		LogError(error);
481 482
		return EXIT_FAILURE;
	}
483

484
#ifdef ENABLE_DAEMON
485
	daemonize_set_user();
486
	daemonize_begin(options.daemon);
487
#endif
Warren Dukes's avatar
Warren Dukes committed
488

489
#ifdef __BLOCKS__
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
	/* Runs the OS X native event loop in the main thread, and runs
	   the rest of mpd_main on a new thread. This lets CoreAudio receive
	   route change notifications (e.g. plugging or unplugging headphones).
	   All hardware output on OS X ultimately uses CoreAudio internally.
	   This must be run after forking; if dispatch is called before forking,
	   the child process will have a broken internal dispatch state. */
	dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
		exit(mpd_main_after_fork(options));
	});
	dispatch_main();
	return EXIT_FAILURE; // unreachable, because dispatch_main never returns
#else
	return mpd_main_after_fork(options);
#endif
}

static int mpd_main_after_fork(struct options options)
507
try {
508 509
	Error error;

510
	ConfigureFS();
511

512
	if (!glue_mapper_init(error)) {
513
		LogError(error);
514 515 516
		return EXIT_FAILURE;
	}

517
	initPermissions();
518
	spl_global_init();
519
#ifdef ENABLE_ARCHIVE
520
	archive_plugin_init_all();
521
#endif
522

523
	pcm_convert_global_init();
524

525
	decoder_plugin_init_all();
526

527
#ifdef ENABLE_DATABASE
528
	const bool create_db = InitDatabaseAndStorage();
529
#endif
530

531
	glue_sticker_init();
532

Max Kellermann's avatar
Max Kellermann committed
533
	command_init();
534
	initAudioConfig();
535
	instance->partition->outputs.Configure(instance->event_loop,
536
					       instance->partition->pc);
537
	client_manager_init();
538
	replay_gain_global_init();
539
	input_stream_global_init();
540
	playlist_list_global_init();
541

542
#ifdef ENABLE_DAEMON
543
	daemonize_commit();
544
#endif
545

546
#ifndef ANDROID
547
	setup_log_output(options.log_stderr);
Warren Dukes's avatar
Warren Dukes committed
548

549
	SignalHandlersInit(instance->event_loop);
550
#endif
551

552
	io_thread_start();
553

554
#ifdef ENABLE_NEIGHBOR_PLUGINS
555 556
	if (instance->neighbors != nullptr)
		instance->neighbors->Open();
557 558
#endif

559
	ZeroconfInit(instance->event_loop);
560

561
	StartPlayerThread(instance->partition->pc);
562

563
#ifdef ENABLE_DATABASE
564
	if (create_db) {
565 566
		/* the database failed to load: recreate the
		   database */
567
		unsigned job = instance->update->Enqueue("", true);
568
		if (job == 0)
569
			FatalError("directory update failed");
570
	}
571
#endif
572

573
	if (!glue_state_file_init(error)) {
574
		LogError(error);
575 576
		return EXIT_FAILURE;
	}
577

578
	instance->partition->outputs.SetReplayGainMode(replay_gain_get_real_mode(instance->partition->playlist.queue.random));
579

580
#ifdef ENABLE_DATABASE
581
	if (config_get_bool(ConfigOption::AUTO_UPDATE, false)) {
582
#ifdef ENABLE_INOTIFY
583
		if (instance->storage != nullptr &&
584
		    instance->update != nullptr)
585
			mpd_inotify_init(instance->event_loop,
586 587
					 *instance->storage,
					 *instance->update,
588
					 config_get_unsigned(ConfigOption::AUTO_UPDATE_DEPTH,
589
							     INT_MAX));
590
#else
591
		FormatWarning(config_domain,
592
			      "inotify: auto_update was disabled. enable during compilation phase");
593
#endif
594
	}
595
#endif
596

597 598
	config_global_check();

599 600
	/* enable all audio outputs (if not already done by
	   playlist_state_restore() */
601
	instance->partition->pc.LockUpdateAudio();
602

603 604 605
#ifdef WIN32
	win32_app_started();
#endif
606

607 608 609 610
	/* the MPD frontend does not care about timer slack; set it to
	   a huge value to allow the kernel to reduce CPU wakeups */
	SetThreadTimerSlackMS(100);

611 612 613 614
#ifdef ENABLE_SYSTEMD_DAEMON
	sd_notify(0, "READY=1");
#endif

615
	/* run the main loop */
616
	instance->event_loop.Run();
617

618 619 620 621
#ifdef WIN32
	win32_app_stopping();
#endif

622 623
	/* cleanup */

624
#if defined(ENABLE_DATABASE) && defined(ENABLE_INOTIFY)
625
	mpd_inotify_finish();
626 627 628

	if (instance->update != nullptr)
		instance->update->CancelAllAsync();
629
#endif
630

631 632 633
	if (instance->state_file != nullptr) {
		instance->state_file->Write();
		delete instance->state_file;
634 635
	}

636
	instance->partition->pc.Kill();
637
	ZeroconfDeinit();
Max Kellermann's avatar
Max Kellermann committed
638
	listen_global_finish();
639
	delete instance->client_list;
640

641 642 643 644 645 646 647
#ifdef ENABLE_NEIGHBOR_PLUGINS
	if (instance->neighbors != nullptr) {
		instance->neighbors->Close();
		delete instance->neighbors;
	}
#endif

648
#ifdef ENABLE_DATABASE
649
	delete instance->update;
650 651 652 653 654

	if (instance->database != nullptr) {
		instance->database->Close();
		delete instance->database;
	}
655 656

	delete instance->storage;
657
#endif
658

659 660 661 662
#ifdef ENABLE_SQLITE
	sticker_global_finish();
#endif

663
	playlist_list_global_finish();
664
	input_stream_global_finish();
665 666

#ifdef ENABLE_DATABASE
667
	mapper_finish();
668 669
#endif

670 671
	DeinitFS();

672
	delete instance->partition;
Max Kellermann's avatar
Max Kellermann committed
673
	command_finish();
674
	decoder_plugin_deinit_all();
675
#ifdef ENABLE_ARCHIVE
676
	archive_plugin_deinit_all();
677
#endif
678
	config_global_finish();
679
	io_thread_deinit();
680
#ifndef ANDROID
681
	SignalHandlersFinish();
682
#endif
683
	delete instance;
684
	instance = nullptr;
685 686

#ifdef ENABLE_DAEMON
687
	daemonize_finish();
688
#endif
689

690 691 692
#ifdef WIN32
	WSACleanup();
#endif
693

694
	IcuFinish();
695

696
	log_deinit();
697
	return EXIT_SUCCESS;
698 699 700
} catch (const std::exception &e) {
	LogError(e);
	return EXIT_FAILURE;
Warren Dukes's avatar
Warren Dukes committed
701
}
Max Kellermann's avatar
Max Kellermann committed
702 703 704 705 706

#ifdef ANDROID

gcc_visibility_default
JNIEXPORT void JNICALL
707
Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context)
Max Kellermann's avatar
Max Kellermann committed
708
{
709 710
	Java::Init(env);
	Java::File::Initialise(env);
711
	Environment::Initialise(env);
712

713 714
	context = new Context(env, _context);

Max Kellermann's avatar
Max Kellermann committed
715
	mpd_main(0, nullptr);
716

717
	delete context;
718
	Environment::Deinitialise(env);
Max Kellermann's avatar
Max Kellermann committed
719 720
}

721 722 723 724 725
gcc_visibility_default
JNIEXPORT void JNICALL
Java_org_musicpd_Bridge_shutdown(JNIEnv *, jclass)
{
	if (instance != nullptr)
726
		instance->Shutdown();
727 728
}

Max Kellermann's avatar
Max Kellermann committed
729
#endif