From 40d3b66807b5bba41030b1830de20b34d766dd26 Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Fri, 22 Mar 2019 20:49:17 +0100 Subject: [PATCH 1/5] Fix assert errors on startup on Linux --- src/slic3r/GUI/Tab.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 48d9ece47..c83feb9c7 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -542,7 +542,10 @@ void Tab::update_changed_tree_ui() auto cur_item = m_treectrl->GetFirstVisibleItem(); if (!cur_item || !m_treectrl->IsVisible(cur_item)) return; - auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection()); + + auto selected_item = m_treectrl->GetSelection(); + auto selection = selected_item ? m_treectrl->GetItemText(selected_item) : ""; + while (cur_item) { auto title = m_treectrl->GetItemText(cur_item); for (auto page : m_pages) @@ -2497,7 +2500,10 @@ void Tab::rebuild_page_tree() if (!have_selection) { // this is triggered on first load, so we don't disable the sel change event - m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem)); + auto item = m_treectrl->GetFirstVisibleItem(); + if (item) { + m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem)); + } } // Thaw(); } @@ -2524,7 +2530,10 @@ void Tab::update_page_tree_visibility() if (!have_selection) { // this is triggered on first load, so we don't disable the sel change event - m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem)); + auto item = m_treectrl->GetFirstVisibleItem(); + if (item) { + m_treectrl->SelectItem(item); + } } } From 36778a1e0d10cd0c8cb97ab9ed9fba9cfe9f950e Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Fri, 22 Mar 2019 23:08:13 +0100 Subject: [PATCH 2/5] Remove double call to GetFirstVisibleItem() --- src/slic3r/GUI/Tab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c83feb9c7..c1c906fec 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2502,7 +2502,7 @@ void Tab::rebuild_page_tree() // this is triggered on first load, so we don't disable the sel change event auto item = m_treectrl->GetFirstVisibleItem(); if (item) { - m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem)); + m_treectrl->SelectItem(item); } } // Thaw(); From 3987296b62933d30d4c5ff8b32b61b66adb60959 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 27 Mar 2019 10:26:55 +0100 Subject: [PATCH 3/5] Improved glsafe macro to print out file name, line number and function name on OpenGL assert. --- src/slic3r/GUI/3DScene.cpp | 4 ++-- src/slic3r/GUI/3DScene.hpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 419f1baae..58011730b 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -32,7 +32,7 @@ #include "GUI.hpp" #ifdef HAS_GLSAFE -void glAssertRecentCallImpl() +void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name) { GLenum err = glGetError(); if (err == GL_NO_ERROR) @@ -47,7 +47,7 @@ void glAssertRecentCallImpl() case GL_OUT_OF_MEMORY: sErr = "Out Of Memory"; break; default: sErr = "Unknown"; break; } - BOOST_LOG_TRIVIAL(error) << "OpenGL error " << (int)err << ": " << sErr; + BOOST_LOG_TRIVIAL(error) << "OpenGL error in " << file_name << ":" << line << ", function " << function_name << "() : " << (int)err << " - " << sErr; assert(false); } #endif diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index d571f862f..e421997e5 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -16,9 +16,9 @@ #endif #ifdef HAS_GLSAFE -extern void glAssertRecentCallImpl(); -inline void glAssertRecentCall() { glAssertRecentCallImpl(); } -#define glsafe(cmd) do { cmd; glAssertRecentCallImpl(); } while (false) +extern void glAssertRecentCallImpl(const char *file_name, unsigned int line, const char *function_name); +inline void glAssertRecentCall() { glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } +#define glsafe(cmd) do { cmd; glAssertRecentCallImpl(__FILE__, __LINE__, __FUNCTION__); } while (false) #else inline void glAssertRecentCall() { } #define glsafe(cmd) cmd From 8ea8eb67e46b019febcbf5c77f5f4e9786aab57e Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 27 Mar 2019 12:02:50 +0100 Subject: [PATCH 4/5] Fixed loading of SVG textures from utf-8 paths --- src/slic3r/GUI/GLTexture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index b48ca2044..c1a035754 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -108,7 +108,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector Date: Wed, 27 Mar 2019 12:14:34 +0100 Subject: [PATCH 5/5] Fix build on MSVC with PCH off --- src/libslic3r/GCode/PostProcessor.cpp | 2 ++ src/slic3r/Config/Version.cpp | 2 ++ src/slic3r/GUI/GUI_Utils.hpp | 2 +- src/slic3r/GUI/Tab.cpp | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp index df4acc1bf..25982959b 100644 --- a/src/libslic3r/GCode/PostProcessor.cpp +++ b/src/libslic3r/GCode/PostProcessor.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef WIN32 @@ -11,6 +12,7 @@ #define WIN32_LEAN_AND_MEAN #define NOMINMAX #include +#include // https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ // This routine appends the given argument to a command line such that CommandLineToArgvW will return the argument string unchanged. diff --git a/src/slic3r/Config/Version.cpp b/src/slic3r/Config/Version.cpp index 70b12f23b..2eda135d6 100644 --- a/src/slic3r/Config/Version.cpp +++ b/src/slic3r/Config/Version.cpp @@ -1,5 +1,7 @@ #include "Version.hpp" +#include + #include #include #include diff --git a/src/slic3r/GUI/GUI_Utils.hpp b/src/slic3r/GUI/GUI_Utils.hpp index d84dd40f9..8d942dcf8 100644 --- a/src/slic3r/GUI/GUI_Utils.hpp +++ b/src/slic3r/GUI/GUI_Utils.hpp @@ -103,7 +103,7 @@ public: } void unbind() { event_storage.reset(nullptr); } - explicit operator bool() const noexcept { return !!event_storage; } + explicit operator bool() const { return !!event_storage; } }; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index c1c906fec..b8122c0d0 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1,4 +1,5 @@ // #include "libslic3r/GCodeSender.hpp" +#include "slic3r/Utils/Serial.hpp" #include "Tab.hpp" #include "PresetBundle.hpp" #include "PresetHints.hpp" @@ -6,7 +7,6 @@ #include "slic3r/Utils/Http.hpp" #include "slic3r/Utils/PrintHost.hpp" -#include "slic3r/Utils/Serial.hpp" #include "BonjourDialog.hpp" #include "WipeTowerDialog.hpp" #include "ButtonsDescription.hpp"