From 1974b3e692a1d817d837bd34a02d6e2971ada5a1 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 12 Jun 2016 12:04:03 +0200 Subject: [PATCH 1/4] Fix deadlock waiting for Python task to end at end of program --- panda/src/display/graphicsEngine.cxx | 3 +++ panda/src/display/graphicsEngine.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 9bd325fc95..da90172088 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -638,6 +638,9 @@ remove_all_windows() { // And, hey, let's stop the vertex paging threads, if any. VertexDataPage::stop_threads(); + // Stopping the tasks means we have to release the Python GIL while + // this method runs (hence it is marked BLOCKING), so that any + // Python tasks on other threads won't deadlock grabbing the GIL. AsyncTaskManager::get_global_ptr()->stop_threads(); #ifdef DO_PSTATS diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index cb371076ee..122d8be359 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -58,7 +58,7 @@ class Texture; class EXPCL_PANDA_DISPLAY GraphicsEngine : public ReferenceCount { PUBLISHED: GraphicsEngine(Pipeline *pipeline = NULL); - ~GraphicsEngine(); + BLOCKING ~GraphicsEngine(); void set_threading_model(const GraphicsThreadingModel &threading_model); GraphicsThreadingModel get_threading_model() const; @@ -94,7 +94,7 @@ PUBLISHED: bool add_window(GraphicsOutput *window, int sort); bool remove_window(GraphicsOutput *window); - void remove_all_windows(); + BLOCKING void remove_all_windows(); void reset_all_windows(bool swapchain); bool is_empty() const; From bf26cecb32d277b63d3bcd867a1147ec8e941176 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 22 Jun 2016 13:44:16 +0200 Subject: [PATCH 2/4] Fix some compile warnings --- panda/src/gobj/shader.cxx | 12 ++++++++---- panda/src/linmath/lvecBase2_src.I | 5 ++--- panda/src/linmath/lvecBase3_src.I | 7 +++---- panda/src/linmath/lvecBase4_src.I | 9 ++++----- panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx | 2 +- panda/src/pnmimagetypes/pnmFileTypePNM.cxx | 4 ++-- panda/src/rocket/rocketRegion_ext.cxx | 3 ++- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index bac1aa61b2..b4b628744a 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -1492,11 +1492,15 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps, compiler_args[nargs++] = "ATI_draw_buffers"; } - char version_arg[16]; - if (!cg_glsl_version.empty() && cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) { - snprintf(version_arg, 16, "version=%s", cg_glsl_version.c_str()); + string version_arg; + if (!cg_glsl_version.empty() && active != CG_PROFILE_UNKNOWN && + cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) { + + version_arg = "version="; + version_arg += cg_glsl_version; + compiler_args[nargs++] = "-po"; - compiler_args[nargs++] = version_arg; + compiler_args[nargs++] = version_arg.c_str(); } compiler_args[nargs] = 0; diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index 14057fbd50..b561cb0b7a 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -514,9 +514,8 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase2):: add_hash(size_t hash) const { TAU_PROFILE("size_t LVecBase2::add_hash(size_t)", " ", TAU_USER); #ifdef FLOATTYPE_IS_INT - int_hash ihasher; - hash = ihasher.add_hash(hash, _v(0)); - hash = ihasher.add_hash(hash, _v(1)); + hash = int_hash::add_hash(hash, _v(0)); + hash = int_hash::add_hash(hash, _v(1)); return hash; #else return add_hash(hash, NEARLY_ZERO(FLOATTYPE)); diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index 41a0d9ccce..13310a8af1 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -674,10 +674,9 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase3):: add_hash(size_t hash) const { TAU_PROFILE("size_t LVecBase3::add_hash(size_t)", " ", TAU_USER); #ifdef FLOATTYPE_IS_INT - int_hash ihasher; - hash = ihasher.add_hash(hash, _v(0)); - hash = ihasher.add_hash(hash, _v(1)); - hash = ihasher.add_hash(hash, _v(2)); + hash = int_hash::add_hash(hash, _v(0)); + hash = int_hash::add_hash(hash, _v(1)); + hash = int_hash::add_hash(hash, _v(2)); return hash; #else return add_hash(hash, NEARLY_ZERO(FLOATTYPE)); diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index f8c8422c58..5b42095e93 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -663,11 +663,10 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase4):: add_hash(size_t hash) const { TAU_PROFILE("size_t LVecBase4::add_hash(size_t)", " ", TAU_USER); #ifdef FLOATTYPE_IS_INT - int_hash ihasher; - hash = ihasher.add_hash(hash, _v(0)); - hash = ihasher.add_hash(hash, _v(1)); - hash = ihasher.add_hash(hash, _v(2)); - hash = ihasher.add_hash(hash, _v(3)); + hash = int_hash::add_hash(hash, _v(0)); + hash = int_hash::add_hash(hash, _v(1)); + hash = int_hash::add_hash(hash, _v(2)); + hash = int_hash::add_hash(hash, _v(3)); return hash; #else return add_hash(hash, NEARLY_ZERO(FLOATTYPE)); diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx index e0ec77441d..917c009647 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx @@ -227,7 +227,7 @@ BMPreadinfoheader( * for the required total. */ if (classv != C_OS2) { - for (int i = 0; i < cbFix - 16; i += 4) { + for (int i = 0; i < (int)cbFix - 16; i += 4) { GetLong(fp); } } diff --git a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx index 6e800c3372..ff22462d11 100644 --- a/panda/src/pnmimagetypes/pnmFileTypePNM.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNM.cxx @@ -650,10 +650,10 @@ writePackedRawRow(ostream * const fileP, const unsigned char * const packed_bits, int const cols) { - int bytesWritten; fileP->write((const char *)packed_bits, pbm_packed_bytes(cols)); - if (fileP->fail()) + if (fileP->fail()) { pm_error("I/O error writing packed row to raw PBM file."); + } } static void diff --git a/panda/src/rocket/rocketRegion_ext.cxx b/panda/src/rocket/rocketRegion_ext.cxx index 06791ded82..a6c0e33a63 100644 --- a/panda/src/rocket/rocketRegion_ext.cxx +++ b/panda/src/rocket/rocketRegion_ext.cxx @@ -45,7 +45,8 @@ get_context() const { context->AddReference(); return py_context.ptr(); - } catch (const python::error_already_set& e) { + } catch (const python::error_already_set &e) { + (void)e; // Return NULL, which will trigger the exception in Python } return NULL; From 0821bec2d0f9664b9a84f9789f37ad918e648e26 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 22 Jun 2016 15:04:00 +0200 Subject: [PATCH 3/4] Backport 2f0bc01 to 1.9: Fix bug causing random crash during module initialization --- .../src/interrogate/interfaceMakerPythonNative.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 1091132312..db1825c079 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -1198,6 +1198,10 @@ write_sub_module(ostream &out, Object *obj) { if (!isExportThisRun(wrapped_itype._cpptype)) { _external_imports.insert(wrapped_itype._cpptype); + } else { + // If this is a typedef to a class defined in the same module, make sure + // that the class is initialized before we try to define the typedef. + out << " Dtool_PyModuleClassInit_" << class_name << "(module);\n"; } } @@ -2595,6 +2599,12 @@ write_module_class(ostream &out, Object *obj) { out << "#if PY_VERSION_HEX >= 0x02050000\n"; write_function_slot(out, 2, slots, "nb_index"); out << "#endif\n"; + + out << "#if PY_VERSION_HEX >= 0x03050000\n"; + write_function_slot(out, 2, slots, "nb_matrix_multiply"); + write_function_slot(out, 2, slots, "nb_inplace_matrix_multiply"); + out << "#endif\n"; + out << "};\n\n"; // NB: it's tempting not to write this table when a class doesn't have them. @@ -2843,6 +2853,10 @@ write_module_class(ostream &out, Object *obj) { out << "#if PY_VERSION_HEX >= 0x02060000\n"; out << " 0, // tp_version_tag\n"; out << "#endif\n"; + // destructor tp_finalize + out << "#if PY_VERSION_HEX >= 0x03040000\n"; + out << " 0, // tp_finalize\n"; + out << "#endif\n"; out << " },\n"; out << " Dtool_UpcastInterface_" << ClassName << ",\n"; out << " Dtool_DowncastInterface_" << ClassName << ",\n"; From 4724a7ddbc6c43d8eabb42bfcadad0309421f194 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 22 Jun 2016 17:22:06 +0200 Subject: [PATCH 4/4] Add 1.9.3 release notes, bump version number --- doc/ReleaseNotes | 18 ++++++++++++++++++ dtool/PandaVersion.pp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 90c661c63a..a4a0b49a02 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -1,3 +1,21 @@ +------------------------ RELEASE 1.9.3 ------------------------ + +This issue fixes several bugs that were still found in 1.9.2. + +* Fix crash when running in Steam on Linux when using OpenAL +* Fix crash using wx/tkinter on Mac as long as want-wx/tk is set +* Fix loading models from 'models' package with models/ prefix +* Fix random crashes in task system +* Fix memory leaks in BulletTriangleMesh +* Fix loading old models with MovingPart +* Improve performance of CPU vertex animation somewhat +* Show framebuffer properties when fbprop request fails +* Fix hang on exit when using Python task on threaded task chain +* Fix inability to get RGBA renderbuffer in certain cases +* Work around GLSL issue with #pragma and certain Intel drivers +* Improve performance of texture load and store operations +* Fix crashes with pbuffers on Intel cards on Windows + ------------------------ RELEASE 1.9.2 ------------------------ This is a minor bugfix release, fixing a few minor issues that diff --git a/dtool/PandaVersion.pp b/dtool/PandaVersion.pp index d6461256ad..0e01d82c67 100644 --- a/dtool/PandaVersion.pp +++ b/dtool/PandaVersion.pp @@ -3,7 +3,7 @@ // ppremake scripts for Panda. // Use spaces to separate the major, minor, and sequence numbers here. -#define PANDA_VERSION 1 9 2 +#define PANDA_VERSION 1 9 3 // This variable will be defined to false in the CVS repository, but // scripts that generate source tarballs and/or binary releases for