Author Topic: code::blocks hangs at startup  (Read 42840 times)

Online killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5542
Re: code::blocks hangs at startup
« Reply #15 on: Yesterday at 09:58:26 am »
2 days ago, since a very long time, I did a fresh build of CB on linux, in Tumbleweed.
Build goes fine, but launching fails. With a similar problem as mentioned above, and the 'renaming' the 3 wxSmith zip files.
Probably when starting a build by excluding these plug-in(s) things would have been ok too.

Code
sudo mv /usr/local/share/codeblocks/wxSmithAui.zip /usr/local/share/codeblocks/wxSmithAui.old
sudo mv /usr/local/share/codeblocks/wxsmithcontribitems.zip /usr/local/share/codeblocks/wxsmithcontribitems.old
sudo mv /usr/local/share/codeblocks/wxsmith.zip /usr/local/share/codeblocks/wxsmith.old

Conclusion: this problem is not solved yet, did anyone in the meantime had a look at it ?



for reference, I stumbled also upon: https://bbs.archlinux.org/viewtopic.php?id=308575

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7813
    • My Best Post
Re: code::blocks hangs at startup
« Reply #16 on: Yesterday at 11:36:16 am »
2 days ago, since a very long time, I did a fresh build of CB on linux, in Tumbleweed.
Build goes fine, but launching fails. With a similar problem as mentioned above, and the 'renaming' the 3 wxSmith zip files.
Probably when starting a build by excluding these plug-in(s) things would have been ok too.

Code
sudo mv /usr/local/share/codeblocks/wxSmithAui.zip /usr/local/share/codeblocks/wxSmithAui.old
sudo mv /usr/local/share/codeblocks/wxsmithcontribitems.zip /usr/local/share/codeblocks/wxsmithcontribitems.old
sudo mv /usr/local/share/codeblocks/wxsmith.zip /usr/local/share/codeblocks/wxsmith.old

Conclusion: this problem is not solved yet, did anyone in the meantime had a look at it ?



for reference, I stumbled also upon: https://bbs.archlinux.org/viewtopic.php?id=308575

What wxWidget version is being used?
My wild guess is the png images; I checked one image file and if not wxCHECK_VERSION(3, 1, 6) then png images are used.
Edit: The single source file (wxsitemeditor.cpp) I checked was the only one that used the svg images if 3.1.6 or newer.

Tim S.
« Last Edit: Yesterday at 11:41:31 am by stahta01 »
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1807
Re: code::blocks hangs at startup
« Reply #17 on: Yesterday at 11:44:33 am »
Works OK on Ubuntu 22.04 with wxWidgets 3.2.6, I cannot check on other Linux. wxSmith uses some initialization tricks that may be non-portable.

This ticket reports that downgrading gdk-pixbuf2 from 2.44.2-1 to 2.42.12-2 fixes the problem.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1807
Re: code::blocks hangs at startup
« Reply #18 on: Yesterday at 01:44:53 pm »
On 2.43 gdk-pixbuf deprecated the XPM api and disabled XPM loader by default, see release notes.

wxSmith defines a XPM in wxSmith.cpp:50 and uses it during plugin attachment in wxSmith.cpp:211; Probably changing this XPM to a PNG or SVG fixes the issue.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1807
Re: code::blocks hangs at startup
« Reply #19 on: Yesterday at 03:48:13 pm »
Replaced XPM with PNG in OnAttach(), see r13773, this may fix the issue (untested).

There are more XPM bitmaps in other parts.

Online killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5542
Re: code::blocks hangs at startup
« Reply #20 on: Yesterday at 03:52:05 pm »
the wxwidgets I used is : 3.2.8

I updated with your latest commit, the problem is still there.

fyi: my gdk-pixbug version is 2.44.4
« Last Edit: Yesterday at 03:54:38 pm by killerbot »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1807
Re: code::blocks hangs at startup
« Reply #21 on: Yesterday at 03:56:41 pm »
Can you put a breakpoint in OnAttach() and check where it hangs?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7813
    • My Best Post
Re: code::blocks hangs at startup
« Reply #22 on: Today at 12:28:16 am »
Patch for my wild guess at the cause, could be multiple causes since wxSmith was written for old wxWidgets version. Edit: My wild guess is that the png files are old enough to break something.

Code
From 784a02fc146d4f1dfb8d259e66e6b99e4667f877 Mon Sep 17 00:00:00 2001
From: Tim Stahlhut <stahta01@gmail.com>
Date: Wed, 21 Jan 2026 17:00:28 -0500
Subject: Add svg guard code to wxSmith

---
 src/plugins/contrib/wxSmith/wxsresourcetree.cpp      |  6 ++++++
 .../wxSmith/wxwidgets/defitems/wxscustomwidget.cpp   |  5 +++++
 .../wxSmith/wxwidgets/defitems/wxsmenuitem.cpp       | 12 +++++++++++-
 .../contrib/wxSmith/wxwidgets/defitems/wxsspacer.cpp |  5 +++++
 .../wxSmith/wxwidgets/defitems/wxstoolbaritem.cpp    | 12 +++++++++++-
 .../contrib/wxSmith/wxwidgets/wxsitemresdata.cpp     |  4 ++++
 6 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/src/plugins/contrib/wxSmith/wxsresourcetree.cpp b/src/plugins/contrib/wxSmith/wxsresourcetree.cpp
index 8295e13cc..a8e3562e6 100644
--- a/src/plugins/contrib/wxSmith/wxsresourcetree.cpp
+++ b/src/plugins/contrib/wxSmith/wxsresourcetree.cpp
@@ -51,9 +51,15 @@ namespace
 }
 
 wxsResourceTree* wxsResourceTree::m_Singleton = nullptr;
+#if wxCHECK_VERSION(3, 1, 6)
+int wxsResourceTree::m_RootImageId = LoadImage(_T("/images/wxsmith/wxSmith16.svg"));
+int wxsResourceTree::m_ProjectImageId = LoadImage(_T("/images/codeblocks.svg"));
+int wxsResourceTree::m_ExternalImageId = LoadImage(_T("/images/wxsmith/deletewidget16.svg"));
+#else
 int wxsResourceTree::m_RootImageId = LoadImage(_T("/images/wxsmith/wxSmith16.png"));
 int wxsResourceTree::m_ProjectImageId = LoadImage(_T("/images/codeblocks.png"));
 int wxsResourceTree::m_ExternalImageId = LoadImage(_T("/images/wxsmith/deletewidget16.png"));
+#endif
 
 
 BEGIN_EVENT_TABLE(wxsResourceTree,wxTreeCtrl)
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxscustomwidget.cpp b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxscustomwidget.cpp
index 1ef204d48..b2281c463 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxscustomwidget.cpp
+++ b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxscustomwidget.cpp
@@ -34,8 +34,13 @@ namespace
         _T("Custom"),
         wxsCPP,
         0,0,
+#if wxCHECK_VERSION(3, 1, 6)
+        _T("images/wxsmith/Custom32.svg"),
+        _T("images/wxsmith/Custom16.svg"));
+#else
         _T("images/wxsmith/Custom32.png"),
         _T("images/wxsmith/Custom16.png"));
+#endif
 
     WXS_EV_BEGIN(wxsCustomWidgetEvents)
         WXS_EV_DEFAULTS()
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsmenuitem.cpp b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsmenuitem.cpp
index a0baaf14a..b579ae331 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsmenuitem.cpp
+++ b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsmenuitem.cpp
@@ -30,7 +30,12 @@ namespace
     {
         public:
 
-            InfoHandler(): m_TreeImage(_T("images/wxsmith/wxMenuItem16.png"),true)
+            InfoHandler():
+#if wxCHECK_VERSION(3, 1, 6)
+                m_TreeImage(_T("images/wxsmith/wxMenuItem16.svg"),true)
+#else
+                m_TreeImage(_T("images/wxsmith/wxMenuItem16.png"),true)
+#endif
             {
                 ClassName      = _T("wxMenuItem");
                 Type           = wxsTTool;
@@ -49,8 +54,13 @@ namespace
                 // TODO: This code should be more generic since it may quickly
                 //       become invalid
                 wxString DataPath = ConfigManager::GetDataFolder() + _T("/images/wxsmith/");
+#if wxCHECK_VERSION(3, 1, 6)
+                Icon32.LoadFile(DataPath+_T("wxMenuItem32.svg"),wxBITMAP_TYPE_ANY);
+                Icon16.LoadFile(DataPath+_T("wxMenuItem16.svg"),wxBITMAP_TYPE_ANY);
+#else
                 Icon32.LoadFile(DataPath+_T("wxMenuItem32.png"),wxBITMAP_TYPE_PNG);
                 Icon16.LoadFile(DataPath+_T("wxMenuItem16.png"),wxBITMAP_TYPE_PNG);
+#endif
                 TreeIconId = m_TreeImage.GetIndex();
             };
 
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsspacer.cpp b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsspacer.cpp
index cb023f9a7..de528b98a 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsspacer.cpp
+++ b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxsspacer.cpp
@@ -38,8 +38,13 @@ namespace
         _T(""),
         wxsCPP,
         2,6,
+#if wxCHECK_VERSION(3, 1, 6)
+        _T("images/wxsmith/Spacer32.svg"),
+        _T("images/wxsmith/Spacer16.svg"));
+#else
         _T("images/wxsmith/Spacer32.png"),
         _T("images/wxsmith/Spacer16.png"));
+#endif
 
     class wxsSpacerPreview : public wxPanel
     {
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxstoolbaritem.cpp b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxstoolbaritem.cpp
index 21e363e5f..95a30d413 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxstoolbaritem.cpp
+++ b/src/plugins/contrib/wxSmith/wxwidgets/defitems/wxstoolbaritem.cpp
@@ -28,7 +28,12 @@ namespace
     {
         public:
 
-            InfoHandler(): m_TreeImage(_T("images/wxsmith/wxToolBarItem16.png"),true)
+            InfoHandler():
+#if wxCHECK_VERSION(3, 1, 6)
+                m_TreeImage(_T("images/wxsmith/wxToolBarItem16.svg"),true)
+#else
+                m_TreeImage(_T("images/wxsmith/wxToolBarItem16.png"),true)
+#endif
             {
                 ClassName      = _T("wxToolBarToolBase");
                 Type           = wxsTTool;
@@ -47,8 +52,13 @@ namespace
                 // TODO: This code should be more generic since it may quickly
                 //       become invalid
                 wxString DataPath = ConfigManager::GetDataFolder() + _T("/images/wxsmith/");
+#if wxCHECK_VERSION(3, 1, 6)
+                Icon32.LoadFile(DataPath+_T("wxToolBarItem32.svg"),wxBITMAP_TYPE_ANY);
+                Icon16.LoadFile(DataPath+_T("wxToolBarItem16.svg"),wxBITMAP_TYPE_ANY);
+#else
                 Icon32.LoadFile(DataPath+_T("wxToolBarItem32.png"),wxBITMAP_TYPE_PNG);
                 Icon16.LoadFile(DataPath+_T("wxToolBarItem16.png"),wxBITMAP_TYPE_PNG);
+#endif
                 TreeIconId = m_TreeImage.GetIndex();
             };
 
diff --git a/src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdata.cpp b/src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdata.cpp
index 143729fa4..88c5c5397 100644
--- a/src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdata.cpp
+++ b/src/plugins/contrib/wxSmith/wxwidgets/wxsitemresdata.cpp
@@ -44,7 +44,11 @@ using namespace wxsFlags;
 
 namespace
 {
+#if wxCHECK_VERSION(3, 1, 6)
+    const int ToolsTreeImageId = wxsResourceTree::LoadImage(_T("images/wxsmith/tools16.svg"));
+#else
     const int ToolsTreeImageId = wxsResourceTree::LoadImage(_T("images/wxsmith/tools16.png"));
+#endif
 }
 
 wxsItemResData::wxsItemResData(
--
2.51.2.windows.1

« Last Edit: Today at 03:05:22 am by stahta01 »
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5542
Re: code::blocks hangs at startup
« Reply #23 on: Today at 08:35:50 am »
I applied this, but no luck, problem still present.

Online killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5542
Re: code::blocks hangs at startup
« Reply #24 on: Today at 03:12:34 pm »
#0  0x00007ffff4f1e80d in syscall () at /lib64/libc.so.6
#1  0x00007ffff4747e95 in std::sys::sync::condvar::futex::Condvar::wait () at /lib64/libglycin-2.so.0
#2  0x00007ffff46cb1bb in parking::Inner::park () at /lib64/libglycin-2.so.0
#3  0x00007ffff45fd656 in gly_loader_load () at /lib64/libglycin-2.so.0
#4  0x00007ffff712325e in ??? () at /lib64/libgdk_pixbuf-2.0.so.0
#5  0x00007ffff7123637 in ??? () at /lib64/libgdk_pixbuf-2.0.so.0
#6  0x00007ffff7113158 in gdk_pixbuf_new_from_file () at /lib64/libgdk_pixbuf-2.0.so.0
#7  0x00007ffff6b7d3b0 in wxBitmap::LoadFile(wxString const&, wxBitmapType) () at /lib64/libwx_gtk3u_core-suse-nostl.so.16.0.0
#8  0x00007fffc8ebe80f in wxsRegisterItem<wxsAnimationCtrl>::wxsRegisterItem(wxString, wxsItemType, wxString, long, bool) ()
    at /usr/local/lib/libwxsmithlib.so.0
#9  0x00007fffc8d6bacf in _GLOBAL__sub_I_wxsanimationctrl.cpp () at /usr/local/lib/libwxsmithlib.so.0


not sure if really usable, can not reproduce, ran in gdb, when it hang : ctrl-c and then bt.
but most of the other times I get something else ...
« Last Edit: Today at 03:21:13 pm by killerbot »

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1807
Re: code::blocks hangs at startup
« Reply #25 on: Today at 04:34:43 pm »
Quote
not sure if really usable

It is very helpful indeed.

IMHO the problem is wxSmith uses global objects to register items:
Code
namespace
{
    wxsRegisterItem<wxsAnimationCtrl> Reg(_T("AnimationCtrl"),wxsTWidget,_T("Standard"),370);

The constructor of wxsRegisterItem (in wxsitemfactory.h:200) calls wxBitmap::LoadFile(), but this call will happen before the image handlers have been initialized because global objects are constructed before program starts.

Code
            wxString DataPath = ConfigManager::GetDataFolder() + _T("/images/wxsmith/");
            Info.Icon32.LoadFile(DataPath+Info.ClassName+_T("32.png"),wxBITMAP_TYPE_PNG);
            Info.Icon16.LoadFile(DataPath+Info.ClassName+_T("16.png"),wxBITMAP_TYPE_PNG);

One possible solution would be delay loading the icons, i.e. load them the first time they are needed.