Author Topic: Crash on startup linux  (Read 11153 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Crash on startup linux
« on: March 18, 2014, 02:21:45 pm »
hi,
i get regular crashes after startup if i change the focus from the splash screen to something else
C::B latest svn with wxWidgets 2.8.12
Linux Mint 15

backtrace from crash log:
Code
    <frame level="0"/>
    <frame level="1" function="wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&amp;)" offset="0000007e"/>
    <frame level="2" function="wxAppBase::ProcessIdle()" offset="00000074"/>
    <frame level="3"/>
    <frame level="4" function="g_main_context_dispatch" offset="00000135"/>
    <frame level="5"/>
    <frame level="6" function="g_main_loop_run" offset="0000006a"/>
    <frame level="7" function="gtk_main" offset="000000a7"/>
    <frame level="8" function="wxEventLoop::Run()" offset="00000048"/>
    <frame level="9" function="wxAppBase::MainLoop()" offset="0000004c"/>

the interesting is: if i use a command line argument like --verbose or --debug-log the crash didn't happen
if i disable the compiler and scripted wizard plugins the crash didn't happen. This two plugins are the only one who print something to the console...

has someone a idea or a hint?
greetings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #1 on: March 18, 2014, 07:36:03 pm »
Does the crash happen if you start C::B under gdb?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Crash on startup linux
« Reply #2 on: March 18, 2014, 07:58:01 pm »
no, i can't reproduce it with gdb, because i 'm somehow not capable of getting any debug output to a console. I mean if i start gdb there is nowhere the output i see normally when i start c::b from the terminal. I think the bug is somewhere in the output code from the plugins... (probably not thread safe?)

greetings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #3 on: March 18, 2014, 09:12:32 pm »
Why do you need to see the output?
There is no threading in the starup code (hope there isn't)!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Crash on startup linux
« Reply #4 on: March 18, 2014, 09:53:32 pm »
Why do you need to see the output?

if i didn't see the output the crash did not happen:

the interesting is: if i use a command line argument like --verbose or --debug-log the crash didn't happen

if i use this arguments, i doesn't see any output in the terminal, and so the crash doesn't happen...

i have reported this issue some time ago, and i was not the only one... http://forums.codeblocks.org/index.php/topic,18580.msg128796.html#msg128796
greetings

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #5 on: March 18, 2014, 10:59:50 pm »
Hm, but then why would gdb interfere with the output?
Does running C::B from terminal cause the same crash?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #6 on: March 18, 2014, 11:02:07 pm »
Hm, I've just tried it and I'm able to reproduce it... let's see if I can find what is causing it...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #7 on: March 18, 2014, 11:18:08 pm »
I guess this is the reason  ::)

Code
==25420== Invalid read of size 8
==25420==    at 0x81AFDE1: wxFrame::OnInternalIdle() (frame.cpp:562)
==25420==    by 0x81CD828: wxAppBase::SendIdleEvents(wxWindow*, wxIdleEvent&) (appcmn.cpp:471)
==25420==    by 0x81CDD54: wxAppBase::ProcessIdle() (appcmn.cpp:443)
==25420==    by 0x814C501: wxapp_idle_callback (app.cpp:213)
==25420==    by 0x6AEC317: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x6AEC687: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x6AECAE9: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x4F6F2E0: gtk_main (gtkmain.c:1257)
==25420==    by 0x81606C7: wxEventLoop::Run() (evtloop.cpp:76)
==25420==    by 0x81CDAFD: wxAppBase::MainLoop() (appcmn.cpp:312)
==25420==    by 0x451091: CodeBlocksApp::OnRun() (app.cpp:818)
==25420==    by 0x8836C84: wxEntry(int&, wchar_t**) (init.cpp:448)
==25420==  Address 0x1491d438 is 712 bytes inside a block of size 888 free'd
==25420==    at 0x4C2B0AC: operator delete(void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25420==    by 0x508927: cbSplashScreen::~cbSplashScreen() (splashscreen.cpp:184)
==25420==    by 0x81CDBEA: wxAppBase::DeletePendingObjects() (appcmn.cpp:423)
==25420==    by 0x81CDD8B: wxAppBase::ProcessIdle() (appcmn.cpp:454)
==25420==    by 0x814C501: wxapp_idle_callback (app.cpp:213)
==25420==    by 0x6AEC317: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x6AEC687: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x6AEC743: g_main_context_iteration (in /usr/lib64/libglib-2.0.so.0.3800.2)
==25420==    by 0x4F6F4E0: gtk_main_iteration (gtkmain.c:1345)
==25420==    by 0x8151BE4: wxClipboard::GetData(wxDataObject&) (clipbrd.cpp:599)
==25420==    by 0x8E83435: EditorManager::OnAppActivated(CodeBlocksEvent&) (editormanager.cpp:1762)
==25420==    by 0x8E84A5B: cbEventFunctor<EditorManager, CodeBlocksEvent>::Call(CodeBlocksEvent&) (in /home/obfuscated/projects/codeblocks/git/src/devel/libcodeblocks.so)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Crash on startup linux
« Reply #8 on: March 18, 2014, 11:41:24 pm »
This patch seems to fix it, but I'm not really sure why.
Also I'm not sure what would be the problems caused by the removal of this code.

Can someone test this on windows, plus all the affected linux users test it, so they can verify the problem is gone?

Code
Index: src/src/splashscreen.cpp
===================================================================
--- src/src/splashscreen.cpp    (revision 9742)
+++ src/src/splashscreen.cpp    (working copy)
@@ -103,9 +103,9 @@ void cbSplashScreen::OnTimer(wxTimerEvent &)

 void cbSplashScreen::OnCloseWindow(wxCloseEvent &)
 {
-    m_timer.Stop();
-    // Don't destroy it here. It creates a dangling pointer in app.cpp and crashes C::B
-    Hide();
+//    m_timer.Stop();
+//    // Don't destroy it here. It creates a dangling pointer in app.cpp and crashes C::B
+//    Hide();
 }

 void cbSplashScreen::OnChar(wxKeyEvent &)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Crash on startup linux
« Reply #9 on: March 19, 2014, 10:00:48 am »
I can now reproduce the bug with gdb. With your patch it doesn't crash within gdb any more, but if i start it from the terminal the crash still happen...
Linux Mint 15

What is this output? valgrind?

greetings