Release-mode DC++ bzr build crashes on context menu display

Bug #533840 reported by cologic
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DC++
Fix Released
High
Unassigned

Bug Description

Steps to reproduce:
1) bzr branch lp:dcplusplus to get new DC++ bzr. (Or use existing local branch.) Build this branch in release mode. Compiler probably matters here; I'm using TDM's mingw 4.4.1-2. Am curious how VS behaves.
2) Arrange DC++ to open such that it doesn't immediately create any tabs (no hubs, no system log, no notepad, et cetera). Close DC++.
3) Start DC++, now configured not to open any tabs.
4) Open one's own filelist (I did it via the file menu, but presumably any mechanism works). It's possible opening other tabs triggers this too; I didn't try.
5) Right-click on that filelist tab. Expected result: some minimal (there are no usercommands, etc) context menu. Actual result:
Program received signal SIGSEGV, Segmentation fault.
0x006e1e02 in dwt::Menu::getCount (this=0xff4cbd80) at dwt\src\widgets\Menu.cpp:821
821 int count = ::GetMenuItemCount(itsHandle);
Current language: auto; currently c++
(gdb) bt
#0 0x006e1e02 in dwt::Menu::getCount (this=0xff4cbd80) at dwt\src\widgets\Menu.cpp:821
#1 0x006e21f6 in dwt::Menu::appendSeparator (this=0xff4cbd80) at dwt\src\widgets\Menu.cpp:758
#2 0x00805b1a in MDIChildFrame<DirectoryListingFrame>::handleContextMenu (this=0x7a2a318,
    pt=@0x28f438) at win32/MDIChildFrame.h:215
#3 0x006db2d3 in dwt::TabView::handleContextMenu (this=0x79c6aa8, pt=DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece.
)
    at dwt\src\widgets\TabView.cpp:512
#4 0x008d308a in std::tr1::_Function_handler<bool ()(dwt::ScreenCoordinate const&), std::tr1::_Bind<std::tr1::_Mem_fn<bool (dwt::TabView::*)(dwt::ScreenCoordinate)> ()(dwt::TabView*, std::tr1::_Placeholder<1>)> >::_M_invoke (__functor=@0x79c6ca8, __args#0=@0x28f468)
    at c:/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/tr1_impl/functional:552
#5 0x008d1fe3 in std::tr1::_Function_handler<bool ()(tagMSG const&, long&), dwt::AspectContextMenu<dwt::Control>::ContextMenuDispatcher>::_M_invoke (__functor=@0x79c6c80, __args#0=@0x28f5a0,
    __args#1=@0x28f5bc)
    at c:/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/tr1_impl/functional:2024
#6 0x006f323d in dwt::Widget::handleMessage (this=0x79c6aa8, msg=@0x28f5a0, retVal=@0x28f5bc)
    at c:/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/tr1_impl/functional:2024
#7 0x006d262a in dwt::Control::handleMessage (this=0x79c6aa8, msg=@0x28f5a0, retVal=@0x28f5bc)
    at dwt\src\widgets\Control.cpp:99
#8 0x006db6ea in dwt::TabView::handleMessage (this=0x79c6aa8, msg=@0x28f5a0, retVal=@0x28f5bc)
    at dwt\src\widgets\TabView.cpp:712
#9 0x006f473d in dwt::WindowProc::wndProc (hwnd=0x4c04f6, uMsg=123, wParam=4982006,
    lParam=11994086) at dwt\src\Dispatcher.cpp:72
#10 0x75a26238 in USER32!IsDialogMessageW () from C:\Windows\syswow64\user32.dll
#11 0x004c04f6 in LogPage (this=0x6f46ac, parent=0x4c04f6) at win32\LogPage.cpp:81
#12 0x75a268ea in USER32!AllowForegroundActivation () from C:\Windows\syswow64\user32.dll
#13 0x006f46ac in ~Dispatcher (this=0x0) at dwt\src\Dispatcher.cpp:184
#14 0x75a28428 in USER32!IsWindow () from C:\Windows\syswow64\user32.dll
#15 0x00000000 in ?? ()

Revision history for this message
eMTee (realprogger) wrote :

I can't reproduce the crash with my own release build using gcc (4.3.3-tdm-1 mingw32).
I can reproduce the crash with a BCDC++ compiled with TDM's mingw 4.4.1-2 (built by Fleetcommand), but only when using themes and extended menus enabled.
XP 32bit

Changed in dcplusplus:
status: New → Confirmed
Revision history for this message
poy (poy) wrote :

found a fix that works (force a function to be inline) but i have no idea why not having the function inline was causing an early deletion of the menu pointer.

for the record, this is specific to MinGW with -O2 (works fine with -O1), and rev 2085 contains the fix.

Changed in dcplusplus:
importance: Undecided → High
status: Confirmed → Fix Committed
Revision history for this message
poy (poy) wrote :

Fixed in version 0.760.

Changed in dcplusplus:
status: Fix Committed → Fix Released
Revision history for this message
poy (poy) wrote :

fixed properly, the calling convention for functions extracted from uxtheme.dll should have been __stdcall instead of __cdecl.

i would expect the current version to produce random crashes for this reason.

Changed in dcplusplus:
status: Fix Released → Fix Committed
Revision history for this message
poy (poy) wrote :

Fixed in version 0.761.

Changed in dcplusplus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.