Package: release.debian.org Severity: normal User: [email protected] Usertags: unblock
Dear release team, Please unblock package megaglest. The megaglest package ships two additional tools, megaglest_editor and megaglest_g3dviewer. Both were unusable due to assertions with the latest version of wxWidgets. This issue was recently resolved by upstream and I cherry-picked the corresponding commits and also added -DNDEBUG to CPPFLAGS. This is Debian Bug https://bugs.debian.org/768572 Please find attached the debdiff against the version of Megaglest in testing. unblock megaglest/3.9.1-2 Regards, Markus
diff -Nru megaglest-3.9.1/debian/changelog megaglest-3.9.1/debian/changelog --- megaglest-3.9.1/debian/changelog 2014-10-03 20:31:07.000000000 +0200 +++ megaglest-3.9.1/debian/changelog 2014-12-01 19:35:11.000000000 +0100 @@ -1,3 +1,15 @@ +megaglest (3.9.1-2) unstable; urgency=medium + + * Add wxWidgets-assertions.patch. + Fix megaglest_editor and megaglest_g3dviewer assertions with newer versions + of wxWidgets that made the tools unusable. (Closes: #768572) + Cherry-picked from upstream master branch. Commits c21317a5f, ad0b65272, + 6faa3dc72. Thanks to Mark Vejvoda for the patch. + * debian/rules: Export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG and disable + wxWidgets assertions. + + -- Markus Koschany <[email protected]> Mon, 01 Dec 2014 19:19:07 +0100 + megaglest (3.9.1-1) unstable; urgency=low [ Mark Vejvoda ] diff -Nru megaglest-3.9.1/debian/patches/series megaglest-3.9.1/debian/patches/series --- megaglest-3.9.1/debian/patches/series 2014-10-03 20:31:07.000000000 +0200 +++ megaglest-3.9.1/debian/patches/series 2014-12-01 19:35:11.000000000 +0100 @@ -1 +1,2 @@ fix-cmake-build-type-none.patch +wxWidgets-assertions.patch diff -Nru megaglest-3.9.1/debian/patches/wxWidgets-assertions.patch megaglest-3.9.1/debian/patches/wxWidgets-assertions.patch --- megaglest-3.9.1/debian/patches/wxWidgets-assertions.patch 1970-01-01 01:00:00.000000000 +0100 +++ megaglest-3.9.1/debian/patches/wxWidgets-assertions.patch 2014-12-01 19:35:11.000000000 +0100 @@ -0,0 +1,168 @@ +From: Markus Koschany <[email protected]> +Date: Mon, 1 Dec 2014 19:12:28 +0100 +Subject: wxWidgets assertions + +Fix wxWidgets assertions in megaglest_editor and megaglest_g3dviewer. + +Bug: https://bugs.debian.org/768572 +Forwarded: not-needed already fixed +--- + source/g3d_viewer/main.cpp | 23 +++++++++++++++-------- + source/g3d_viewer/main.h | 1 + + source/glest_map_editor/main.cpp | 20 +++++++++++++++----- + source/shared_lib/sources/graphics/model.cpp | 2 +- + 4 files changed, 32 insertions(+), 14 deletions(-) + +diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp +index 1276f73..a6cdb4a 100644 +--- a/source/g3d_viewer/main.cpp ++++ b/source/g3d_viewer/main.cpp +@@ -480,12 +480,15 @@ void MainWindow::setupTimer() { + } + + void MainWindow::setupStartupSettings() { +- GLuint err = glewInit(); +- if (GLEW_OK != err) { ++ ++ glCanvas->setCurrentGLContext(); ++ ++ GLuint err = glewInit(); ++ if (GLEW_OK != err) { + fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err)); + //return 1; + throw std::runtime_error((char *)glewGetErrorString(err)); +- } ++ } + + renderer= Renderer::getInstance(); + +@@ -567,7 +570,7 @@ MainWindow::~MainWindow(){ + void MainWindow::init() { + + #if wxCHECK_VERSION(2, 9, 3) +- glCanvas->setCurrentGLContext(); ++ //glCanvas->setCurrentGLContext(); + //printf("setcurrent #1\n"); + #elif wxCHECK_VERSION(2, 9, 1) + +@@ -585,7 +588,9 @@ void MainWindow::init() { + void MainWindow::onPaint(wxPaintEvent &event) { + if(!IsShown()) return; + +-#if wxCHECK_VERSION(2, 9, 3) ++#if wxCHECK_VERSION(2, 9, 4) ++ //glCanvas->setCurrentGLContext(); ++#elif wxCHECK_VERSION(2, 9, 3) + + #elif wxCHECK_VERSION(2, 9, 1) + glCanvas->setCurrentGLContext(); +@@ -756,8 +761,8 @@ void MainWindow::onClose(wxCloseEvent &event){ + delete timer; + timer = NULL; + +- delete model; +- model = NULL; ++ //delete model; ++ //model = NULL; + + delete renderer; + renderer = NULL; +@@ -2027,7 +2032,7 @@ GlCanvas::GlCanvas(MainWindow * mainWindow, int *args) + } + + GlCanvas::~GlCanvas() { +- delete this->context; ++ if(this->context) delete this->context; + this->context = NULL; + } + +@@ -2037,11 +2042,13 @@ void GlCanvas::setCurrentGLContext() { + #if wxCHECK_VERSION(2, 9, 1) + if(this->context == NULL) { + this->context = new wxGLContext(this); ++ //printf("Set ctx [%p]\n",this->context); + } + #endif + //printf("Set ctx [%p]\n",this->context); + if(this->context) { + wxGLCanvas::SetCurrent(*this->context); ++ //printf("Set ctx2 [%p]\n",this->context); + } + #else + this->SetCurrent(); +diff --git a/source/g3d_viewer/main.h b/source/g3d_viewer/main.h +index d22020d..e8142b8 100644 +--- a/source/g3d_viewer/main.h ++++ b/source/g3d_viewer/main.h +@@ -201,6 +201,7 @@ public: + void onKeyDown(wxKeyEvent &event); + void setCurrentGLContext(); + ++ wxGLContext * getCtx() { return context; } + private: + MainWindow *mainWindow; + wxGLContext *context; +diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp +index 9b2dc57..e9c9b7c 100644 +--- a/source/glest_map_editor/main.cpp ++++ b/source/glest_map_editor/main.cpp +@@ -138,12 +138,12 @@ END_EVENT_TABLE() + + void MainWindow::init(string fname) { + #if wxCHECK_VERSION(2, 9, 3) +- glCanvas->setCurrentGLContext(); ++ //glCanvas->setCurrentGLContext(); + //printf("setcurrent #1\n"); + #elif wxCHECK_VERSION(2, 9, 1) + + #else +- glCanvas->SetCurrent(); ++ //glCanvas->SetCurrent(); + //printf("setcurrent #2\n"); + #endif + +@@ -638,11 +638,17 @@ void MainWindow::onPaint(wxPaintEvent &event) { + return; + } + +-#if wxCHECK_VERSION(2, 9, 3) ++//#if wxCHECK_VERSION(2, 9, 3) + +-#elif wxCHECK_VERSION(2, 9, 1) ++//#elif wxCHECK_VERSION(2, 9, 1) ++// glCanvas->setCurrentGLContext(); ++//#endif ++ ++ //static bool contextSet = false; ++ //if(contextSet == false) { ++ // contextSet = true; + glCanvas->setCurrentGLContext(); +-#endif ++ //} + + if(lastPaintEvent.getMillis() < 30) { + sleep(1); +@@ -1579,6 +1585,10 @@ bool App::OnInit() { + SystemFlags::VERBOSE_MODE_ENABLED = false; + SystemFlags::ENABLE_THREADED_LOGGING = false; + ++#if defined(wxMAJOR_VERSION) && defined(wxMINOR_VERSION) && defined(wxRELEASE_NUMBER) && defined(wxSUBRELEASE_NUMBER) ++ printf("Using wxWidgets version [%d.%d.%d.%d]\n",wxMAJOR_VERSION,wxMINOR_VERSION,wxRELEASE_NUMBER,wxSUBRELEASE_NUMBER); ++#endif ++ + string fileparam; + if(argc==2){ + if(argv[1][0]=='-') { // any flag gives help and exits program. +diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp +index e3bf3cf..84becdb 100644 +--- a/source/shared_lib/sources/graphics/model.cpp ++++ b/source/shared_lib/sources/graphics/model.cpp +@@ -1099,7 +1099,7 @@ Model::Model() { + } + + Model::~Model() { +- delete [] meshes; ++ if(meshes) delete [] meshes; + meshes = NULL; + } + diff -Nru megaglest-3.9.1/debian/rules megaglest-3.9.1/debian/rules --- megaglest-3.9.1/debian/rules 2014-10-03 20:31:07.000000000 +0200 +++ megaglest-3.9.1/debian/rules 2014-12-01 19:35:11.000000000 +0100 @@ -1,5 +1,7 @@ #!/usr/bin/make -f export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +# Disable wxWidgets assertions +export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG %: dh $@ --parallel

