From e15cfd74e8bd19cffbfea723eb583af63e307ad0 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 13 May 2017 21:40:22 +0200 Subject: [PATCH 1/4] Prevent assertion when calculating bounds for geom without vertices --- panda/src/gobj/geom.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 66d7c19e62..2b16a915cd 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -1257,15 +1257,15 @@ compute_internal_bounds(Geom::CData *cdata, Thread *current_thread) const { InternalName::get_vertex(), cdata, current_thread); - nassertv(!pmin.is_nan()); - nassertv(!pmax.is_nan()); - BoundingVolume::BoundsType btype = cdata->_bounds_type; if (btype == BoundingVolume::BT_default) { btype = bounds_type; } if (found_any) { + nassertv(!pmin.is_nan()); + nassertv(!pmax.is_nan()); + // Then we put the bounding volume around both of those points. PN_stdfloat avg_box_area; switch (btype) { From 325ac4c114b68afbcd224f42442c2c32a8519545 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 13 May 2017 21:59:29 +0200 Subject: [PATCH 2/4] Fix memory tracking bug - DeletedBufferChain erroneously showed leak --- dtool/src/dtoolbase/deletedBufferChain.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtool/src/dtoolbase/deletedBufferChain.cxx b/dtool/src/dtoolbase/deletedBufferChain.cxx index 0451ada7d3..27d7214d79 100644 --- a/dtool/src/dtoolbase/deletedBufferChain.cxx +++ b/dtool/src/dtoolbase/deletedBufferChain.cxx @@ -106,8 +106,8 @@ deallocate(void *ptr, TypeHandle type_handle) { assert(ptr != (void *)NULL); #ifdef DO_MEMORY_USAGE - type_handle.dec_memory_usage(TypeHandle::MC_deleted_chain_active, - _buffer_size + flag_reserved_bytes); + const size_t alloc_size = _buffer_size + flag_reserved_bytes + MEMORY_HOOK_ALIGNMENT - 1; + type_handle.dec_memory_usage(TypeHandle::MC_deleted_chain_active, alloc_size); // type_handle.inc_memory_usage(TypeHandle::MC_deleted_chain_inactive, // _buffer_size + flag_reserved_bytes); From 81e414030e587c8c0377e9010b12cc7c6995eee5 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 13 May 2017 23:30:09 +0200 Subject: [PATCH 3/4] Fix RenderState cache leak - gc did not work properly (Thanks to deflected for helping to track this down) --- panda/src/pgraph/renderState.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panda/src/pgraph/renderState.cxx b/panda/src/pgraph/renderState.cxx index e92f284cc1..d8cd5a6dd3 100644 --- a/panda/src/pgraph/renderState.cxx +++ b/panda/src/pgraph/renderState.cxx @@ -947,8 +947,6 @@ garbage_collect() { return num_attribs; } - bool break_and_uniquify = (auto_break_cycles && uniquify_transforms); - LightReMutexHolder holder(*_states_lock); PStatTimer timer(_garbage_collect_pcollector); @@ -961,10 +959,12 @@ garbage_collect() { return num_attribs; } + bool break_and_uniquify = (auto_break_cycles && uniquify_transforms); + size_t si = _garbage_index; num_this_pass = min(num_this_pass, size); - size_t stop_at_element = (si + num_this_pass) % (size - 1); + size_t stop_at_element = (si + num_this_pass) & (size - 1); do { if (_states->has_element(si)) { From 560fd4eb3d4fef02e156a2c6f278458bf16561fc Mon Sep 17 00:00:00 2001 From: deflected Date: Sat, 13 May 2017 23:33:52 +0200 Subject: [PATCH 4/4] panda: Get rid of few warnings - Correct missing override - Correct deprecated XKeycodeToKeysym - Correct deprecated @exec for FreeBSD pkg plist Signed-off-by: deflected Closes #144 --- makepanda/makepanda.py | 6 +++--- panda/src/display/get_x11.h | 1 + panda/src/egg/eggLine.h | 11 +++++++---- panda/src/egg/eggNurbsCurve.h | 9 ++++++--- panda/src/egg/eggNurbsSurface.h | 11 +++++++---- panda/src/egg/eggPatch.h | 9 ++++++--- panda/src/egg/eggPoint.h | 11 +++++++---- panda/src/egg/eggPolygon.h | 11 +++++++---- panda/src/egg/eggTriangleFan.h | 15 +++++++++------ panda/src/egg/eggTriangleStrip.h | 13 ++++++++----- panda/src/x11display/x11GraphicsWindow.cxx | 2 +- 11 files changed, 62 insertions(+), 37 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index af4cb2dca5..69b4265801 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -864,7 +864,7 @@ if (COMPILER=="GCC"): if not PkgSkip("NVIDIACG") and not RUNTIME: SmartPkgEnable("CGGL", "", ("CgGL"), "Cg/cgGL.h", thirdparty_dir = "nvidiacg") if not RUNTIME: - SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h")) + SmartPkgEnable("X11", "x11", "X11", ("X11", "X11/Xlib.h", "X11/XKBlib.h")) if GetHost() != "darwin": # Workaround for an issue where pkg-config does not include this path @@ -7216,8 +7216,8 @@ def MakeInstallerFreeBSD(): plist_txt += os.path.join(root, f)[21:] + "\n" if not RUNTIME: - plist_txt += "@exec /sbin/ldconfig -m /usr/local/lib\n" - plist_txt += "@unexec /sbin/ldconfig -R\n" + plist_txt += "@postexec /sbin/ldconfig -m /usr/local/lib\n" + plist_txt += "@postunexec /sbin/ldconfig -R\n" for remdir in ("lib/panda3d", "share/panda3d", "include/panda3d"): for root, dirs, files in os.walk("targetroot/usr/local/" + remdir, False): diff --git a/panda/src/display/get_x11.h b/panda/src/display/get_x11.h index f9112766d7..57ca5cf44e 100644 --- a/panda/src/display/get_x11.h +++ b/panda/src/display/get_x11.h @@ -45,6 +45,7 @@ struct XVisualInfo; #else #include "pre_x11_include.h" +#include #include #include #include diff --git a/panda/src/egg/eggLine.h b/panda/src/egg/eggLine.h index 059dfa7648..72ea411cdc 100644 --- a/panda/src/egg/eggLine.h +++ b/panda/src/egg/eggLine.h @@ -31,7 +31,7 @@ PUBLISHED: virtual EggLine *make_copy() const OVERRIDE; - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; INLINE bool has_thick() const; INLINE double get_thick() const; @@ -39,7 +39,7 @@ PUBLISHED: INLINE void clear_thick(); protected: - virtual int get_num_lead_vertices() const; + virtual int get_num_lead_vertices() const OVERRIDE; private: double _thick; @@ -54,10 +54,13 @@ public: register_type(_type_handle, "EggLine", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggNurbsCurve.h b/panda/src/egg/eggNurbsCurve.h index 9797a12ea8..4225549736 100644 --- a/panda/src/egg/eggNurbsCurve.h +++ b/panda/src/egg/eggNurbsCurve.h @@ -50,7 +50,7 @@ PUBLISHED: INLINE double get_knot(int k) const; MAKE_SEQ(get_knots, get_num_knots, get_knot); - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; MAKE_PROPERTY(order, get_order, set_order); MAKE_PROPERTY(degree, get_degree); @@ -72,10 +72,13 @@ public: register_type(_type_handle, "EggNurbsCurve", EggCurve::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggNurbsSurface.h b/panda/src/egg/eggNurbsSurface.h index 8e09d43fbd..83900282f0 100644 --- a/panda/src/egg/eggNurbsSurface.h +++ b/panda/src/egg/eggNurbsSurface.h @@ -75,14 +75,14 @@ PUBLISHED: MAKE_SEQ(get_v_knots, get_num_v_knots, get_v_knot); INLINE EggVertex *get_cv(int ui, int vi) const; - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; public: Curves _curves_on_surface; Trims _trims; protected: - virtual void r_apply_texmats(EggTextureCollection &textures); + virtual void r_apply_texmats(EggTextureCollection &textures) OVERRIDE; private: typedef vector_double Knots; @@ -101,10 +101,13 @@ public: register_type(_type_handle, "EggNurbsSurface", EggSurface::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggPatch.h b/panda/src/egg/eggPatch.h index 63cfc61353..4358149131 100644 --- a/panda/src/egg/eggPatch.h +++ b/panda/src/egg/eggPatch.h @@ -30,7 +30,7 @@ PUBLISHED: virtual EggPatch *make_copy() const OVERRIDE; - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; public: static TypeHandle get_class_type() { @@ -41,10 +41,13 @@ public: register_type(_type_handle, "EggPatch", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggPoint.h b/panda/src/egg/eggPoint.h index ae7d7e1d34..93ed683133 100644 --- a/panda/src/egg/eggPoint.h +++ b/panda/src/egg/eggPoint.h @@ -40,9 +40,9 @@ PUBLISHED: INLINE void set_perspective(bool perspective); INLINE void clear_perspective(); - virtual bool cleanup(); + virtual bool cleanup() OVERRIDE; - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; private: enum Flags { @@ -64,10 +64,13 @@ public: register_type(_type_handle, "EggPoint", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggPolygon.h b/panda/src/egg/eggPolygon.h index a549af3bf7..5d25c554be 100644 --- a/panda/src/egg/eggPolygon.h +++ b/panda/src/egg/eggPolygon.h @@ -29,7 +29,7 @@ PUBLISHED: virtual EggPolygon *make_copy() const OVERRIDE; - virtual bool cleanup(); + virtual bool cleanup() OVERRIDE; bool calculate_normal(LNormald &result, CoordinateSystem cs = CS_default) const; bool is_planar() const; @@ -39,7 +39,7 @@ PUBLISHED: INLINE bool triangulate_into(EggGroupNode *container, bool convex_also) const; PT(EggPolygon) triangulate_in_place(bool convex_also); - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; private: bool decomp_concave(EggGroupNode *container, int asum, int x, int y) const; @@ -55,10 +55,13 @@ public: register_type(_type_handle, "EggPolygon", EggPrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggTriangleFan.h b/panda/src/egg/eggTriangleFan.h index 0a5e3f1e35..f2ca8e32b5 100644 --- a/panda/src/egg/eggTriangleFan.h +++ b/panda/src/egg/eggTriangleFan.h @@ -31,12 +31,12 @@ PUBLISHED: virtual EggTriangleFan *make_copy() const OVERRIDE; - virtual void write(ostream &out, int indent_level) const; - virtual void apply_first_attribute(); + virtual void write(ostream &out, int indent_level) const OVERRIDE; + virtual void apply_first_attribute() OVERRIDE; protected: - virtual int get_num_lead_vertices() const; - virtual bool do_triangulate(EggGroupNode *container) const; + virtual int get_num_lead_vertices() const OVERRIDE; + virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE; public: static TypeHandle get_class_type() { @@ -47,10 +47,13 @@ public: register_type(_type_handle, "EggTriangleFan", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/egg/eggTriangleStrip.h b/panda/src/egg/eggTriangleStrip.h index 202172d1cd..a84d0cd751 100644 --- a/panda/src/egg/eggTriangleStrip.h +++ b/panda/src/egg/eggTriangleStrip.h @@ -31,11 +31,11 @@ PUBLISHED: virtual EggTriangleStrip *make_copy() const OVERRIDE; - virtual void write(ostream &out, int indent_level) const; + virtual void write(ostream &out, int indent_level) const OVERRIDE; protected: - virtual int get_num_lead_vertices() const; - virtual bool do_triangulate(EggGroupNode *container) const; + virtual int get_num_lead_vertices() const OVERRIDE; + virtual bool do_triangulate(EggGroupNode *container) const OVERRIDE; public: static TypeHandle get_class_type() { @@ -46,10 +46,13 @@ public: register_type(_type_handle, "EggTriangleStrip", EggCompositePrimitive::get_class_type()); } - virtual TypeHandle get_type() const { + virtual TypeHandle get_type() const OVERRIDE { + return get_class_type(); + } + virtual TypeHandle force_init_type() OVERRIDE { + init_type(); return get_class_type(); } - virtual TypeHandle force_init_type() {init_type(); return get_class_type();} private: static TypeHandle _type_handle; diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 3ea2cd3fb0..17a8121efc 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -2051,7 +2051,7 @@ get_keyboard_map() const { continue; } - KeySym sym = XKeycodeToKeysym(_display, k, 0); + KeySym sym = XkbKeycodeToKeysym(_display, k, 0, 0); ButtonHandle button = map_button(sym); if (button == ButtonHandle::none()) { continue;