Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDE hangs (copy-paste) between files #673

Closed
niziak opened this issue Jul 27, 2016 · 7 comments
Closed

IDE hangs (copy-paste) between files #673

niziak opened this issue Jul 27, 2016 · 7 comments
Assignees

Comments

@niziak
Copy link

niziak commented Jul 27, 2016

I'm using zbstudio (8c82419) (wxwidgets31x-upgrade) started in gdb.
IDE hands with 100% CPU usage.
Just before hang, I've created new lua file and I was moving code from existing lua file to newly created. I was moving function by function using ctrl-x ctrl+v. After a while it hangs (during ctrl+v).
Backtrace after stopping program in gdb

#0  0x00007ffff739a4f7 in __GI___libc_malloc (bytes=64) at malloc.c:2925
#1  0x00007ffff3c4c678 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00007ffff6ae1082 in wxPen::wxPen(wxColour const&, int, wxPenStyle) () from bin/linux/x64/clibs/libwx.so
#3  0x00007ffff6a4449c in SurfaceImpl::PenColour(ColourDesired) () from bin/linux/x64/clibs/libwx.so
#4  0x00007ffff6c6b0b2 in Indicator::Draw(Surface*, PRectangle const&, PRectangle const&, Indicator::DrawState, int) const () from bin/linux/x64/clibs/libwx.so
#5  0x00007ffff6ce4b60 in ?? () from bin/linux/x64/clibs/libwx.so
#6  0x00007ffff6ce4df2 in ?? () from bin/linux/x64/clibs/libwx.so
#7  0x00007ffff6cea92e in EditView::DrawLine(Surface*, EditModel const&, ViewStyle const&, LineLayout const*, int, int, int, PRectangle, int, DrawPhase) () from bin/linux/x64/clibs/libwx.so
#8  0x00007ffff6ceb7e2 in EditView::PaintText(Surface*, EditModel const&, PRectangle, PRectangle, ViewStyle const&) () from bin/linux/x64/clibs/libwx.so
#9  0x00007ffff6c64136 in Editor::Paint(Surface*, PRectangle) () from bin/linux/x64/clibs/libwx.so
#10 0x00007ffff6a468dd in ScintillaWX::DoPaint(wxDC*, wxRect) () from bin/linux/x64/clibs/libwx.so
#11 0x00007ffff6a3a1ea in wxStyledTextCtrl::OnPaint(wxPaintEvent&) () from bin/linux/x64/clibs/libwx.so
#12 0x00007ffff6bce4f4 in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const () from bin/linux/x64/clibs/libwx.so
#13 0x00007ffff6c3a99a in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from bin/linux/x64/clibs/libwx.so
#14 0x00007ffff6c3aa17 in wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) () from bin/linux/x64/clibs/libwx.so
#15 0x00007ffff6c3b154 in wxEvtHandler::TryHereOnly(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#16 0x00007ffff6c3b18d in wxEvtHandler::ProcessEventLocally(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#17 0x00007ffff6c3b20b in wxEvtHandler::ProcessEvent(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#18 0x00007ffff6c3b239 in wxEvtHandler::SafelyProcessEvent(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#19 0x00007ffff6aedc7c in wxWindow::GTKSendPaintEvents(_GdkRegion const*) () from bin/linux/x64/clibs/libwx.so
#20 0x00007ffff6aeddfb in ?? () from bin/linux/x64/clibs/libwx.so
#21 0x00007ffff559f99c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#22 0x00007ffff425dfa5 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007ffff426ffc1 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff42787f9 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff427908f in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff56b731c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#27 0x00007ffff559e752 in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#28 0x00007ffff51f9baf in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#29 0x00007ffff51f9b55 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#30 0x00007ffff51f9b55 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#31 0x00007ffff51f9b55 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#32 0x00007ffff51f6681 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#33 0x00007ffff51f714d in gdk_window_process_updates () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#34 0x00007ffff6aec023 in wxWindow::Update() () from bin/linux/x64/clibs/libwx.so
#35 0x00007ffff6a5a609 in wxAuiNotebook::SetPageText(unsigned long, wxString const&) () from bin/linux/x64/clibs/libwx.so
#36 0x00007ffff6954e08 in ?? () from bin/linux/x64/clibs/libwx.so
#37 0x000000000043213a in ?? ()
#38 0x000000000041460b in lua_pcall ()
#39 0x00007ffff6a1cb25 in wxLuaState::LuaPCall(int, int) () from bin/linux/x64/clibs/libwx.so
#40 0x00007ffff6a11974 in wxLuaEventCallback::OnEvent(wxEvent*) () from bin/linux/x64/clibs/libwx.so
#41 0x00007ffff6a11791 in wxLuaEventCallback::OnAllEvents(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#42 0x00007ffff6bce4f4 in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const () from bin/linux/x64/clibs/libwx.so
#43 0x00007ffff6c3a99a in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) () from bin/linux/x64/clibs/libwx.so
#44 0x00007ffff6c3b08e in wxEvtHandler::SearchDynamicEventTable(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#45 0x00007ffff6c3b136 in wxEvtHandler::TryHereOnly(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#46 0x00007ffff6c3b18d in wxEvtHandler::ProcessEventLocally(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#47 0x00007ffff6c3b20b in wxEvtHandler::ProcessEvent(wxEvent&) () from bin/linux/x64/clibs/libwx.so
#48 0x00007ffff6a3ebf1 in wxStyledTextCtrl::NotifyParent(SCNotification*) () from bin/linux/x64/clibs/libwx.so
#49 0x00007ffff6a4542a in ScintillaWX::NotifyParent(SCNotification) () from bin/linux/x64/clibs/libwx.so
#50 0x00007ffff6c594db in Editor::NotifySavePoint(bool) () from bin/linux/x64/clibs/libwx.so

I set breakpoints at

  • EditView::DrawLine
  • Indicator::Draw

But it stops all the time on Indicator::Draw

@pkulchenko
Copy link
Owner

@niziak, are you using ArchLinux? I presume the file copied is not large. Is it reproducible every time?

@pkulchenko pkulchenko self-assigned this Jul 27, 2016
@pkulchenko
Copy link
Owner

@niziak, can you try the following path to see if it resolves the issue:

diff --git a/src/editor/editor.lua b/src/editor/editor.lua
index 7bc87f1..f88a569 100644
--- a/src/editor/editor.lua
+++ b/src/editor/editor.lua
@@ -1117,17 +1117,17 @@ function CreateEditor(bare)
       end
     end)

-  editor:Connect(wxstc.wxEVT_STC_SAVEPOINTREACHED,
-    function ()
+  local function updateModified()
+    local update = function()
       local doc = ide:GetDocument(editor)
-      if doc then doc:SetModified(false) end
-    end)
-
-  editor:Connect(wxstc.wxEVT_STC_SAVEPOINTLEFT,
-    function ()
-      local doc = ide:GetDocument(editor)
-      if doc then doc:SetModified(true) end
-    end)
+      if doc then doc:SetModified(editor:GetModify()) end
+    end
+    -- delay update on Unix/Linux as it seems to hang the application on ArchLinux;
+    -- execute immediately on other platforms
+    if ide.osname == "Unix" then editor:DoWhenIdle(update) else update() end
+  end
+  editor:Connect(wxstc.wxEVT_STC_SAVEPOINTREACHED, updateModified)
+  editor:Connect(wxstc.wxEVT_STC_SAVEPOINTLEFT, updateModified)

   -- "updateStatusText" should be called in UPDATEUI event, but it creates
   -- several performance problems on Windows (using wx2.9.5+) when

@pkulchenko
Copy link
Owner

pkulchenko commented Jul 28, 2016

Other ArchLinux related issues: #506, #662, and #425 (with recent comment).

@pkulchenko
Copy link
Owner

@niziak, I pushed the diff I proposed earlier to the master branch and would be interested to know if it fixes the issue for you. Note that this change hasn't been merged into the upgrade branch yet. Thanks!

@niziak
Copy link
Author

niziak commented Aug 2, 2016

It seems that patch helps for this issue. I'm working intensively fourth day on patched zbstudio and I cannot observe any crashes ('wxwidgets31x-upgrade' branch + patch). Now I will try on master branch.

@pkulchenko
Copy link
Owner

@niziak, that's great; thank you for the update. I've enabled a couple of checks in the wxlua code (will be included in the new binaries in the upgrade branch shortly), but was hoping that the patch may help.

I'd be interested in the results you have on the master branch (it already includes the patch) as I'd like to confirm that the crashes are gone there as well.

@pkulchenko
Copy link
Owner

@niziak, closing this as the patch has been merged into master; please re-open if you still see this issue on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants