Hi,

This diff includes 2 types of changes that I think can be reasonably
lumped together as quality-of-life improvements, one for the editor
(bin/godot-tools), and the other one for export template (bin/godot).

First, fix up execpath by hardcoding it again. I think this was dropped
when godot switched to MULTI_PACKAGES [1]. It's fairly straightforward
to drop this back in with #ifdef TOOLS_ENABLED ... #else ... #endif.
This fixes returning to the project manager when quitting the editor
with Shift-Ctrl-Q or menu Project -> Quit to Project List. (Without
this patch what happens is that it will just abort with an error about
not finding its binary, rather than returning to the project manager.)

The other part (in object.cpp and resource.cpp) hides 2 warnings/non-
breaking errors behind '--verbose' flag for the export template
(bin/godot). It's about the following warnings:

WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object.cpp:2070)
ERROR: Resources still in use at exit (run with --verbose for details).
   at: clear (core/resource.cpp:417)

The rationale is that they occur because the project itself has unfreed
objects/resources at exit. There is nothing that the user of bin/godot
can really do about it and it's fairly common. godot is already quite
verbose, so this cuts down a bit on some not too helpful messages.
Nothing changes for the editor (bin/godot-tools), so anyone using this
for development will not encounter any changes here.

ok?

[1] 
https://github.com/openbsd/ports/commit/36c4fbb44ede3f69ad631a54ae608308398b5f3c

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/godot/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- Makefile    13 Aug 2023 12:34:23 -0000      1.48
+++ Makefile    13 Aug 2023 19:37:41 -0000
@@ -7,7 +7,7 @@ V =             3.5.2
 GODOTSTEAM_V = v3.20
 DISTNAME =     godot-${V}-stable
 PKGNAME =      godot-${V}
-REVISION =     4
+REVISION =     5
 
 CATEGORIES =   games
 
Index: patches/patch-core_object_cpp
===================================================================
RCS file: patches/patch-core_object_cpp
diff -N patches/patch-core_object_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_object_cpp       13 Aug 2023 19:37:41 -0000
@@ -0,0 +1,19 @@
+when building without tools, don't warn about leaked instances at exit unless 
'--verbose'
+
+Index: core/object.cpp
+--- core/object.cpp.orig
++++ core/object.cpp
+@@ -2067,8 +2067,13 @@ RWLock ObjectDB::rw_lock;
+ void ObjectDB::cleanup() {
+       rw_lock.write_lock();
+       if (instances.size()) {
++#ifdef TOOLS_ENABLED
+               WARN_PRINT("ObjectDB instances leaked at exit (run with 
--verbose for details).");
++#endif
+               if (OS::get_singleton()->is_stdout_verbose()) {
++#ifndef TOOLS_ENABLED
++                      WARN_PRINT("ObjectDB instances leaked at exit (run with 
--verbose for details).");
++#endif
+                       // Ensure calling the native classes because if a 
leaked instance has a script
+                       // that overrides any of those methods, it'd not be OK 
to call them at this point,
+                       // now the scripting languages have already been 
terminated.
Index: patches/patch-core_os_os_cpp
===================================================================
RCS file: patches/patch-core_os_os_cpp
diff -N patches/patch-core_os_os_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_os_os_cpp        13 Aug 2023 19:37:41 -0000
@@ -0,0 +1,21 @@
+hardcode _execpath on OpenBSD
+
+Index: core/os/os.cpp
+--- core/os/os.cpp.orig
++++ core/os/os.cpp
+@@ -182,7 +182,15 @@ String OS::get_clipboard_primary() const {
+ }
+ 
+ String OS::get_executable_path() const {
++#ifdef __OpenBSD__
++#ifdef TOOLS_ENABLED
++      return "/usr/local/bin/godot-tools";
++#else
++      return "/usr/local/bin/godot";
++#endif
++#else
+       return _execpath;
++#endif
+ }
+ 
+ int OS::get_process_id() const {
Index: patches/patch-core_resource_cpp
===================================================================
RCS file: patches/patch-core_resource_cpp
diff -N patches/patch-core_resource_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-core_resource_cpp     13 Aug 2023 19:37:41 -0000
@@ -0,0 +1,20 @@
+when building without tools, don't display error about resources still in use 
at
+exit unless '--verbose'
+
+Index: core/resource.cpp
+--- core/resource.cpp.orig
++++ core/resource.cpp
+@@ -414,8 +414,13 @@ RWLock ResourceCache::path_cache_lock;
+ 
+ void ResourceCache::clear() {
+       if (resources.size()) {
++#ifdef TOOLS_ENABLED
+               ERR_PRINT("Resources still in use at exit (run with --verbose 
for details).");
++#endif
+               if (OS::get_singleton()->is_stdout_verbose()) {
++#ifndef TOOLS_ENABLED
++              ERR_PRINT("Resources still in use at exit (run with --verbose 
for details).");
++#endif
+                       const String *K = nullptr;
+                       while ((K = resources.next(K))) {
+                               Resource *r = resources[*K];

Reply via email to