Blocking an application built in debugging mode (Issue #26263)

42 views
Skip to first unread message

levinsv

unread,
Mar 5, 2026, 1:23:44 AM (10 days ago) Mar 5
to wx-...@googlegroups.com, Subscribed
levinsv created an issue (wxWidgets/wxWidgets#26263)

Description

Blocking an application built in debugging mode with the message

 wxASSERT_MSG( c < 0x80,
                          wxT("Non-ASCII value passed to FromAscii().") );

This message cannot be closed.
This message appears if the clipboard contains a type name with UTF-8 characters.
Example:

image.png (view on web)

This can be achieved by running LibreOffice Draw and copying an image to the clipboard.

Platform and version information

  • wxWidgets version you use: 3.2.2
  • wxWidgets port you use: wxGTK
  • OS and its version: alt linux 10.4
    • GTK version: 3.24.32
    • Which GDK backend is used: X11
    • Desktop environment : Gnome


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263@github.com>

VZ

unread,
Mar 5, 2026, 7:51:49 AM (9 days ago) Mar 5
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26263)

We need a way to reproduce this in order to do anything about it. Please read the issue reporting guide and either explain how to reproduce this in a sample (text sample uses clipboard) or at least show the stack trace when the assert happens.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4004840892@github.com>

levinsv

unread,
Mar 5, 2026, 1:35:41 PM (9 days ago) Mar 5
to wx-...@googlegroups.com, Subscribed
levinsv left a comment (wxWidgets/wxWidgets#26263)

A full stacktrace showed that the problem was calling the "CanPaste()" method of the wxStyledTextCtrl class.
Inserting into a buffer of a problematic type.
copy_clipboard.c

GUI application where the CanPaste() method is called
main.cpp

Compile:

gcc $(pkg-config --cflags gtk+-3.0) -o copy_clipboard copy_clipboard.c $(pkg-config --libs gtk+-3.0)

g++ $(wx-config --cflags) -o gui_test main.cpp $(wx-config --libs) -lwx_gtk3u_stc-3.2


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4006920950@github.com>

VZ

unread,
Mar 5, 2026, 2:31:13 PM (9 days ago) Mar 5
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26263)

Do you still see this with 3.2.10? I can't reproduce it with this version, neither with X11 nor Wayland. Moreover, I just don't see how can FromAscii() be called when CanPaste() is just this:

bool wxStyledTextCtrl::CanPaste() const
{
    return SendMsg(SCI_CANPASTE, 0, 0) != 0;
}

If you can reproduce it, please show the stack trace to help understanding how do we end up in FromAscii().

Also please mention if you use any non-default build options.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4007237810@github.com>

levinsv

unread,
Mar 5, 2026, 10:02:43 PM (9 days ago) Mar 5
to wx-...@googlegroups.com, Subscribed
levinsv left a comment (wxWidgets/wxWidgets#26263)

wx-config --version-full
3.2.2.0

libc.so.6!poll (Unknown Source:0)
libglib-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_loop_run (Unknown Source:0)
libgtk-3.so.0!gtk_dialog_run (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxGUIAppTraits::ShowAssertDialog(wxString const&) (Unknown Source:0)
libwx_baseu-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libwx_baseu-3.2.so.0!wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxApp::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) (Unknown Source:0)
libwx_baseu-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libwx_baseu-3.2.so.0!wxOnAssert(char const*, int, char const*, char const*, wchar_t const*) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxString::FromAscii(char const*, unsigned long) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxString::FromAscii(char const*) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxDataFormat::GetId() const (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_valist (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_by_name (Unknown Source:0)
libgtk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_valist (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit (Unknown Source:0)
libgtk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgtk-3.so.0!gtk_main_do_event (Unknown Source:0)
libgdk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_context_dispatch (Unknown Source:0)
libglib-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_context_iteration (Unknown Source:0)
libgtk-3.so.0!gtk_main_iteration (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxGUIEventLoop::DoYieldFor(long) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEventLoopBase::YieldFor(long) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxClipboard::DoIsSupported(wxDataFormat const&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxClipboard::IsSupported(wxDataFormat const&) (Unknown Source:0)
libwx_gtk3u_stc-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libwx_gtk3u_stc-3.2.so.0!wxStyledTextCtrl::CanPaste() const (Unknown Source:0)
frmQuery::updateMenu(frmQuery * const this, bool allowUpdateModelSize) (/home/lsv/pgadmin3/frm/frmQuery.cpp:1912)
frmQuery::OnSqlBookPageChanged(frmQuery * const this, wxAuiNotebookEvent & event) (/home/lsv/pgadmin3/frm/frmQuery.cpp:4517)
libwx_baseu-3.2.so.0!wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::TryHereOnly(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::DoTryChain(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::ProcessEvent(wxEvent&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxWindowBase::TryAfter(wxEvent&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxWindowBase::TryAfter(wxEvent&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxWindowBase::TryAfter(wxEvent&) (Unknown Source:0)
libwx_gtk3u_aui-3.2.so.0!wxAuiNotebook::DoModifySelection(unsigned long, bool) (Unknown Source:0)
ctlAuiNotebook::DoModifySelection(ctlAuiNotebook * const this, size_t n, bool events) (/home/lsv/pgadmin3/include/ctl/ctlAuiNotebook.h:35)
libwx_gtk3u_aui-3.2.so.0!wxAuiNotebook::InsertPage(unsigned long, wxWindow*, wxString const&, bool, wxBitmapBundle const&) (Unknown Source:0)
frmQuery::SqlBookAddPage(frmQuery * const this, wxString & title) (/home/lsv/pgadmin3/frm/frmQuery.cpp:4731)
frmQuery::frmQuery(frmQuery * const this, frmMain * form, const wxString & _title, pgConn * _conn, const wxString & query, wxUtfFile file) (/home/lsv/pgadmin3/frm/frmQuery.cpp:919)
queryToolBaseFactory::StartDialogSql(queryToolBaseFactory * const this, frmMain * form, pgObject * obj, const wxString & sql) (/home/lsv/pgadmin3/frm/frmQuery.cpp:4928)
queryToolFactory::StartDialog(queryToolFactory * const this, frmMain * form, pgObject * obj) (/home/lsv/pgadmin3/frm/frmQuery.cpp:4962)
frmMain::OnAction(frmMain * const this, wxCommandEvent & ev) (/home/lsv/pgadmin3/frm/events.cpp:243)
libwx_baseu-3.2.so.0!wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::SearchDynamicEventTable(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::TryHereOnly(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::DoTryChain(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::ProcessEvent(wxEvent&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxWindowBase::TryAfter(wxEvent&) (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEvtHandler::SafelyProcessEvent(wxEvent&) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxMenuBase::DoProcessEvent(wxMenuBase*, wxEvent&, wxWindow*) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxMenuBase::SendEvent(int, int) (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_closure_invoke (Unknown Source:0)
libgobject-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_valist (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit (Unknown Source:0)
libgtk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_closure_invoke (Unknown Source:0)
libgobject-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_valist (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit (Unknown Source:0)
libgtk-3.so.0!gtk_accel_group_activate (Unknown Source:0)
libgtk-3.so.0!gtk_accel_groups_activate (Unknown Source:0)
libgtk-3.so.0!gtk_window_activate_key (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_closure_invoke (Unknown Source:0)
libgobject-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit_valist (Unknown Source:0)
libgobject-2.0.so.0!g_signal_emit (Unknown Source:0)
libgtk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libgtk-3.so.0!gtk_main_do_event (Unknown Source:0)
libgdk-3.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_context_dispatch (Unknown Source:0)
libglib-2.0.so.0![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libglib-2.0.so.0!g_main_loop_run (Unknown Source:0)
libgtk-3.so.0!gtk_main (Unknown Source:0)
libwx_gtk3u_core-3.2.so.0!wxGUIEventLoop::DoRun() (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEventLoopBase::Run() (Unknown Source:0)
libwx_baseu-3.2.so.0!wxAppConsoleBase::MainLoop() (Unknown Source:0)
libwx_baseu-3.2.so.0!wxEntry(int&, wchar_t**) (Unknown Source:0)
main(int argc, char ** argv) (/home/lsv/pgadmin3/pgAdmin3.cpp:128)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4009229567@github.com>

VZ

unread,
Mar 6, 2026, 9:21:02 AM (8 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26263)

Thanks, I see what happens now. The use of wxString::FromAscii() in wxDataFormat::GetId() is indeed wrong, we have no reason to suppose that this string contains ASCII characters only. Amazingly nobody noticed it until now even if the code was there ever since 2e1d710 (Further UNicode fixes., 2002-08-15).

I'll fix this but for some reason I still can't reproduce the bug. Apparently it happens because the test GTK program doesn't work for me: it doesn't put the data in custom format on clipboard somehow. Under Wayland it doesn't seem to put any data on clipboard at all:

$ wl-paste -l
Nothing is copied

and running it with GDK_BACKEND=x11 it does put "custom data" on clipboard but I can't access its type:

$ xclip -selection clipboard -o -t TARGETS
Error: target TARGETS not available

So could you please test this change:

diff --git a/src/gtk/dataobj.cpp b/src/gtk/dataobj.cpp
index 15336d2511..7d76f4c5d3 100644
--- a/src/gtk/dataobj.cpp
+++ b/src/gtk/dataobj.cpp
@@ -140,7 +140,11 @@ wxDataFormatId wxDataFormat::GetType() const
 wxString wxDataFormat::GetId() const
 {
     wxGtkString atom_name(gdk_atom_name(m_format));
-    return wxString::FromAscii(atom_name);
+
+    // In practice atom name is always in UTF-8, but don't lose the name
+    // entirely if it isn't.
+    wxMBConvUTF8 conv(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA);
+    return wxString(conv.cMB2WX(atom_name.c_str()));
 }
 
 void wxDataFormat::SetId( NativeFormat format )

and let me know if it works for you?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4012027745@github.com>

VZ

unread,
Mar 6, 2026, 9:32:52 AM (8 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26263)

BTW, I've also failed to reproduce this with LibreOffice: if I copy an image from it, I get the following type on clipboard:

$ wl-paste -l                             
application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object Descriptor (XML)";classname="4BAB8970-8A3B-45B3-991c-cbeeac6bd5e3";typename="LibreOffice 25.2 Drawing";displayname="file:///tmp/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82.odg";viewaspect="1";width="5719";height="4131";posx="0";posy="0"
application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source (XML)"
application/x-openoffice-drawing;windows_formatname="Drawing Format"
application/x-openoffice-gdimetafile;windows_formatname="GDIMetaFile"
application/x-openoffice-emf;windows_formatname="Image EMF"
application/x-openoffice-wmf;windows_formatname="Image WMF"
image/svg+xml;windows_formatname="image/svg+xml"
image/png
application/x-openoffice-bitmap;windows_formatname="Bitmap"
image/bmp
application/x-libreoffice-internal-id-814802
SAVE_TARGETS

i.e. UTF-8 string "привет" is percent-encoded for me. No idea why it behaves differently for you.

But we still shouldn't assert on encountering non-ASCII strings, of course.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4012099179@github.com>

levinsv

unread,
Mar 7, 2026, 9:01:01 AM (7 days ago) Mar 7
to wx-...@googlegroups.com, Subscribed
levinsv left a comment (wxWidgets/wxWidgets#26263)

I checked the changes. The message is not displayed. Thanks.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26263/4016570838@github.com>

VZ

unread,
Mar 7, 2026, 10:54:21 AM (7 days ago) Mar 7
to wx-...@googlegroups.com, Subscribed

Closed #26263 as completed via 654d784.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26263/issue_event/23359571834@github.com>

Reply all
Reply to author
Forward
0 new messages