TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
1.88k stars 224 forks source link

BadLength error typing in compile dialog #2154

Closed hemebond closed 5 years ago

hemebond commented 6 years ago

System Information

TrenchBroom v2.0.2 Release on Debian GNU/Linux testing (buster) (TrenchBroom-Linux-v2.0.2-Release.x86_64.deb) xorg/testing,now 1:7.7+19 amd64 gnome-shell/testing,now 3.28.2-1 amd64 libgtk-3-0/testing,now 3.22.29-3 amd64

Expected Behavior

Edit text like a regular text field.

Steps to Reproduce

  1. Under profile add Run Tool detail;
  2. Enter text into the Parameters text field; and
  3. Crash application by:
    • Trying to delete text using backspace (doesn't work)
    • Try moving cursor with arrow keys (doesn't work)
    • Select text using the mouse type to replace

Crash Info

(trenchbroom:12326): Gtk-CRITICAL **: 16:00:05.379: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed
(trenchbroom:12326): Gtk-CRITICAL **: 16:00:05.379: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed
(trenchbroom:12326): Gtk-CRITICAL **: 16:00:05.382: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed
The program 'trenchbroom' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadLength (poly request too large or internal Xlib length erro'.
  (Details: serial 549374 error_code 16 request_code 18 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

The only way to edit text in a text field is to select the text using the mouse and type to replace it.

ericwa commented 6 years ago

I set up a debian testing in a Virtualbox VM and can't reproduce this. Same package versions.

Not sure what to do next :( It's probably a wxWidgets bug since we don't touch Xlib directly.. TB ships a statically linked copy of wxWidgets 3.1.1.

ericwa commented 6 years ago

@kduske should we investigate supporting the wxWidgets 3.0.3+ stable branch so we could use system copy of wx on Linux? (if it's easy to do so, anyway.)

I was just checking the change log and "3.0.3: (released 2017-05-02)" has a change " Allow requesting modern (3.x+) OpenGL version in wxGLCanvas (Fabio Arnold)." Was that the reason we were requiring 3.1.x in the first place? https://github.com/wxWidgets/wxWidgets/blob/v3.0.4/docs/changes.txt#L671

hemebond commented 6 years ago

Are there any other libraries that I can get you the versions for?

kduske commented 6 years ago

@ericwa yes, that‘s one of the reasons a downgrade to 3.0 will be difficult

ericwa commented 6 years ago

Ah, ok, maybe it's not worth it.

I took a valgrind log on the debian system, and at one point got some invalid reads when hitting Backspace on that Parameters text field so I'm going to investigate these. It didn't happen right away but I created several Run Tool actions, scrolled the list a bit, edited various text fields, etc.

valgrind.log

ericwa commented 6 years ago

Never mind, those valgrind reports seem to be false positives. @hemebond did you get a crash log in ~/Documents?

hemebond commented 6 years ago

@ericwa I don't see a log file, no. Is that the only place it creates the log file?

ericwa commented 6 years ago

I double checked, it only saves the crash log to ~/Documents if the map was unsaved. If the map was saved, the crash log should be in the same directory as the map, named: <mapname>-crash.txt

Is the crash easy to reproduce for you? Does it crash with an empty compilation profile, adding a Run Tool step, then typing in the params text box and deleting?

There was a similar X11 error a few years ago, I was just looking over the comments there: https://github.com/kduske/TrenchBroom/issues/1367#issuecomment-229121508

If you don't mind trying some debugging this might give a backtrace:

sudo apt install libgtk2.0-0-dbg
gdb --args trenchbroom --sync
b gdk_x_error
run
hemebond commented 6 years ago

I do not have any GDK debug package available to me.

It turned out to be more difficult to crash under gdb, and this particular crash occurred while editing a compile profile with one Run Tool step and deleting that step.

$ gdb --args trenchbroom --sync
GNU gdb (Debian 7.12-6+b2) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from trenchbroom...(no debugging symbols found)...done.
(gdb) b gdk_x_error
Function "gdk_x_error" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (gdk_x_error) pending.
(gdb) run
Starting program: /usr/bin/trenchbroom --sync
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Gtk-Message: 18:49:43.030: Failed to load module "canberra-gtk-module"
[New Thread 0x7fffe7b98700 (LWP 21798)]
[New Thread 0x7fffe7397700 (LWP 21799)]
[New Thread 0x7fffe6b96700 (LWP 21800)]
[New Thread 0x7fffe6395700 (LWP 21801)]
[New Thread 0x7fffe5b94700 (LWP 21802)]

(trenchbroom:21757): Gtk-CRITICAL **: 18:49:44.673: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed

(trenchbroom:21757): Gtk-CRITICAL **: 18:49:44.673: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed

(trenchbroom:21757): Gtk-CRITICAL **: 18:49:44.676: IA__gtk_widget_set_size_request: assertion 'height >= -1' failed

Thread 1 "trenchbroom" received signal SIGSEGV, Segmentation fault.
0x0000000000ad1ef0 in TrenchBroom::TemporarilySetBool::TemporarilySetBool(bool&, bool) ()
(gdb) bt
#0  0x0000000000ad1ef0 in TrenchBroom::TemporarilySetBool::TemporarilySetBool(bool&, bool) ()
#1  0x000000000098842e in TrenchBroom::Model::CompilationProfile::removeTask(unsigned long) ()
#2  0x0000000000b3b878 in TrenchBroom::View::CompilationProfileEditor::OnRemoveTask(wxCommandEvent&) ()
#3  0x0000000001018afe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
#4  0x0000000001145954 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
#5  0x0000000001145e7a in wxEvtHandler::SearchDynamicEventTable(wxEvent&) ()
#6  0x000000000114613f in wxEvtHandler::TryHereOnly(wxEvent&) ()
#7  0x00000000011461d6 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
#8  0x000000000114625d in wxEvtHandler::ProcessEvent(wxEvent&) ()
#9  0x0000000000b038a9 in TrenchBroom::View::BitmapButton::OnMouseDown(wxMouseEvent&) ()
#10 0x0000000001018afe in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
#11 0x0000000001145954 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
#12 0x0000000001145e7a in wxEvtHandler::SearchDynamicEventTable(wxEvent&) ()
#13 0x000000000114613f in wxEvtHandler::TryHereOnly(wxEvent&) ()
#14 0x00000000011461d6 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
#15 0x000000000114625d in wxEvtHandler::ProcessEvent(wxEvent&) ()
#16 0x0000000001147b97 in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
#17 0x0000000000e1f3ac in  ()
#18 0x00007ffff6ef02ab in  () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#19 0x00007ffff5b93f6d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007ffff5ba6d3e in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff5baed8f in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007ffff5bafe0f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff700626c in  () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#24 0x00007ffff6eee54c in gtk_propagate_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#25 0x00007ffff6eee94b in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#26 0x00007ffff6b6404c in  () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#27 0x00007ffff58ba287 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff58ba4c0 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff58ba7d2 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007ffff6eed977 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#31 0x0000000000e0a385 in wxGUIEventLoop::DoRun() ()
#32 0x000000000105413a in wxEventLoopBase::Run() ()
#33 0x000000000101f679 in wxAppConsoleBase::MainLoop() ()
#34 0x0000000000ad81fe in TrenchBroom::View::TrenchBroomApp::OnRun() ()
#35 0x00000000010a1f24 in wxEntry(int&, wchar_t**) ()
#36 0x000000000085dd58 in main ()

The trigger here was a little different to usual but there comes a point where I can't type anything in the text boxes.

Oh, and there is no crash log created as far as I can see.

ericwa commented 6 years ago

Thanks, this stack trace helps. It looks like the currently selected list index from wxWidgets is out of bounds of the "tasks" array, which then crashes.

I still can't explain the crash when pressing "backspace" in the parameters text field, and I don't know why I can't reproduce it. If you can manage to get a gdb stack trace of the "backspace" crash that would be helpful.

kduske commented 5 years ago

I cannot reproduce either of these problems in XUbuntu 16.04.

hemebond commented 5 years ago

I just installed 2.0.3. Backspace appears to partially work sometimes, but you can't see any change until you resize the dialog window (causing the textbox to re-render/refresh?).

Update: It appears the backspace isn't processed until I resize the dialog window. Which means if I backspace, then enter text, then resize the window, this happens (where < is the backspace press):

-bounce -bouncescale 2<1 -dirtdebug ${MAP_BASE_NAME}.bsp

-bounce -bouncescale 2 -dirtdebug ${MAP_BASE_NAME}.bsp

kduske commented 5 years ago

I'm sorry, but I'm going to close this as we have been unable to reproduce this. If there is anything new, please reopen this and we'll look into it again.

hemebond commented 5 years ago

Not going to re-open but thought I'd link to this wxWidgets bug which seems to describe the issues I'm seeing http://trac.wxwidgets.org/ticket/16840

I installed ibus-gtk and ibus-gtk3, the started Trenchbroom with:

$ export GTK_IM_MODULE=ibus
$ trenchbroom

and the text inputs seem to work fine now :-)

kduske commented 5 years ago

Thanks for letting us know!