Ver Fonte

Merge branch 'release/1.10.x'

rdb há 3 anos atrás
pai
commit
4040e7b390

+ 18 - 3
panda/src/cocoadisplay/cocoaPandaAppDelegate.mm

@@ -13,6 +13,7 @@
 
 
 #import "cocoaPandaAppDelegate.h"
 #import "cocoaPandaAppDelegate.h"
 #include "graphicsEngine.h"
 #include "graphicsEngine.h"
+#include "config_cocoadisplay.h"
 
 
 @implementation CocoaPandaAppDelegate
 @implementation CocoaPandaAppDelegate
 
 
@@ -33,12 +34,26 @@
 - (BOOL)applicationShouldTerminate:(NSApplication *)app {
 - (BOOL)applicationShouldTerminate:(NSApplication *)app {
   if (cocoadisplay_cat.is_debug()) {
   if (cocoadisplay_cat.is_debug()) {
     cocoadisplay_cat.debug()
     cocoadisplay_cat.debug()
-      << "Received applicationShouldTerminate, closing all Cocoa windows\n";
+      << "Received applicationShouldTerminate, requesting to close all Cocoa windows\n";
   }
   }
-  // Call performClose on all the windows.  This should make ShowBase shut down.
+  // Ask all the windows whether they are OK to be closed.
+  bool should_close = true;
   for (NSWindow *window in [app windows]) {
   for (NSWindow *window in [app windows]) {
-    [window performClose:nil];
+    if (![[window delegate] windowShouldClose:window]) {
+      should_close = false;
+    }
   }
   }
+  if (should_close) {
+    if (cocoadisplay_cat.is_debug()) {
+      cocoadisplay_cat.debug()
+        << "No window objected to close request, closing all windows\n";
+    }
+    // If so (none of them fired a close request event), close them now.
+    for (NSWindow *window in [app windows]) {
+      [window close];
+    }
+  }
+  // Give the application a chance to run its own cleanup functions.
   return FALSE;
   return FALSE;
 }
 }
 
 

+ 1 - 0
panda/src/cocoadisplay/cocoaPandaWindowDelegate.mm

@@ -12,6 +12,7 @@
  */
  */
 
 
 #import "cocoaPandaWindowDelegate.h"
 #import "cocoaPandaWindowDelegate.h"
+#include "config_cocoadisplay.h"
 
 
 @implementation CocoaPandaWindowDelegate
 @implementation CocoaPandaWindowDelegate
 - (id) initWithGraphicsWindow:(CocoaGraphicsWindow*)window {
 - (id) initWithGraphicsWindow:(CocoaGraphicsWindow*)window {

+ 1 - 0
panda/src/gobj/texture.I

@@ -26,6 +26,7 @@ INLINE PT(Texture) Texture::
 make_copy() const {
 make_copy() const {
   PT(Texture) tex = make_copy_impl();
   PT(Texture) tex = make_copy_impl();
   CDWriter cdata_tex(tex->_cycler, true);
   CDWriter cdata_tex(tex->_cycler, true);
+  cdata_tex->_render_to_texture = false;
   cdata_tex->inc_properties_modified();
   cdata_tex->inc_properties_modified();
   cdata_tex->inc_image_modified();
   cdata_tex->inc_image_modified();
   return tex;
   return tex;

+ 1 - 0
panda/src/gobj/texture.cxx

@@ -10819,6 +10819,7 @@ CData() {
 Texture::CData::
 Texture::CData::
 CData(const Texture::CData &copy) {
 CData(const Texture::CData &copy) {
   _num_mipmap_levels_read = 0;
   _num_mipmap_levels_read = 0;
+  _render_to_texture = copy._render_to_texture;
 
 
   do_assign(&copy);
   do_assign(&copy);