User forums > Help
wxsmith crashes while dragging
rartigas:
Hi
I have a consistent crash when moving objects on the WxSmith editor. I created a simple project using WxWidgets version 3.2, with WxSmith Frame Based. After adding a couple of objects (a couple of Button) onto the Form, and while dragging them to re-position, Codeblocks crashes with the following message:
artigas@McBoock codeblocks_dbgrpt-23210-20231127T222916 % cat codeblocks.xml
<?xml version="1.0" encoding="UTF-8"?>
<report version="1.0" kind="exception">
<system description="macOS Ventura Version 13.6 (Build 22G120)"/>
<stack>
<frame level="0" function="wxFatalSignalHandler(int)" offset="0" address="0x1033c8c5c"/>
<frame level="1" function="_sigtramp" offset="0" address="0x7ff80927d5ed"/>
<frame level="2" function="_sigtramp" offset="0" address="0xaaaaaaaaaaaaaaaa"/>
<frame level="3" function="wxsItemEditorContent::OnMouse(wxMouseEvent&)" offset="0" address="0x110e8c1f5"/>
<frame level="4" function="wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)" offset="0" address="0x1033d17af"/>
<frame level="5" function="wxEvtHandler::ProcessEventLocally(wxEvent&)" offset="0" address="0x1033d24ca"/>
<frame level="6" function="wxEvtHandler::ProcessEvent(wxEvent&)" offset="0" address="0x1033d23c0"/>
<frame level="7" function="wxScrollHelperEvtHandler::ProcessEvent(wxEvent&)" offset="0" address="0x104b37c52"/>
<frame level="8" function="wxEvtHandler::SafelyProcessEvent(wxEvent&)" offset="0" address="0x1033d28dc"/>
<frame level="9" function="wxWidgetCocoaImpl::DoHandleMouseEvent(NSEvent*)" offset="0" address="0x1049ece19"/>
<frame level="10" function="wxWidgetCocoaImpl::mouseEvent(NSEvent*, NSView*, void*)" offset="0" address="0x1049e7720"/>
<frame level="11" function="-[NSWindow _handleMouseDraggedEvent:]" offset="0" address="0x7ff80cd03c4b"/>
<frame level="12" function="-[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]" offset="0" address="0x7ff80c52982b"/>
<frame level="13" function="-[NSWindow(NSEventRouting) sendEvent:]" offset="0" address="0x7ff80c529427"/>
<frame level="14" function="-[wxNSWindow sendEvent:]" offset="0" address="0x1049d284b"/>
<frame level="15" function="-[NSApplication(NSEvent) sendEvent:]" offset="0" address="0x7ff80c527e01"/>
<frame level="16" function="-[wxNSApplication sendEvent:]" offset="0" address="0x104920472"/>
<frame level="17" function="-[NSApplication _handleEvent:]" offset="0" address="0x7ff80c7e274e"/>
<frame level="18" function="-[NSApplication run]" offset="0" address="0x7ff80c3b77ad"/>
<frame level="19" function="wxGUIEventLoop::OSXDoRun()" offset="0" address="0x1049c8cba"/>
<frame level="20" function="wxCFEventLoop::DoRun()" offset="0" address="0x1033b1c0d"/>
<frame level="21" function="wxEventLoopBase::Run()" offset="0" address="0x10330fdd5"/>
<frame level="22" function="wxAppConsoleBase::MainLoop()" offset="0" address="0x1032e74b4"/>
<frame level="23" function="wxApp::OnRun()" offset="0" address="0x10496285a"/>
<frame level="24" function="CodeBlocksApp::OnRun()" offset="0" address="0x10258af0b"/>
<frame level="25" function="wxEntry(int&, wchar_t**)" offset="0" address="0x1033412e9"/>
<frame level="26" function="main" offset="0" address="0x102581fb3"/>
<frame level="27" function="start" offset="0" address="0x7ff808ef641f"/>
</stack>
</report>
I'm using the following configuration:
OS: Mac OS Ventura
Codeblocks 20.03 from Xaviou, rev13394
WxWidgets version 3.2
I also tried other compilations but all them fail at the same point, while other do only show a Black screen on the WxSmith editor. What is works is editing the (X,Y) position of the object without any crash.
Thanks for any help or workarround.
Roger
Miguel Gimenez:
0xaaaaaaaaaaaaaaaa means that the code has accesed freed memory, but I can not see where this may happen. This is the relevant code:
--- Code: ---void wxsItemEditorContent::OnMouse(wxMouseEvent& event)
{
// Anti-recursion lock
static bool IsRunning = false;
if ( IsRunning ) return;
IsRunning = true;
if ( event.ButtonDown() )
{
SetFocus();
}
else if ( m_MouseState == msWaitForIdle )
{
m_MouseState = msIdle;
}
int NewX = event.m_x;
int NewY = event.m_y;
CalcUnscrolledPosition(NewX,NewY,&NewX,&NewY);
event.m_x = NewX;
event.m_y = NewY;
switch ( m_MouseState )
{
case msDraggingPointInit: OnMouseDraggingPointInit (event); break;
case msDraggingPoint: OnMouseDraggingPoint (event); break;
case msDraggingItemInit: OnMouseDraggingItemInit (event); break;
case msDraggingItem: OnMouseDraggingItem (event); break;
case msTargetSearch: OnMouseTargetSearch (event); break;
case msWaitForIdle: break;
case msIdle: // fall-through
default: OnMouseIdle (event); break;
}
IsRunning = false;
}
--- End code ---
EDIT: Cannot reproduce on MSW, may be MacOS-specific.
omlk:
--- Quote from: Miguel Gimenez on November 28, 2023, 10:05:55 am ---0xaaaaaaaaaaaaaaaa means that the code has accesed freed memory, but I can not see where this may happen. This is the relevant code:
--- Code: ---void wxsItemEditorContent::OnMouse(wxMouseEvent& event)
{
// Anti-recursion lock
static bool IsRunning = false;
if ( IsRunning ) return;
IsRunning = true;
...
IsRunning = false;
}
--- End code ---
EDIT: Cannot reproduce on MSW, may be MacOS-specific.
--- End quote ---
Maybe the usage int StopPropagation () would be better?
--- Code: --- // Anti-recursion lock
static int recursion_count = 0;
static bool IsRunning = false;
if ( ++recursion_count > 2 ) {
recursion_count = 0;
event.StopPropagation();
return;
}
if ( IsRunning ) return;
--- End code ---
sodev:
I suggest next time you post something, you do more research about the topic, this is not the first time you post such nonsense.
A wxMouseEvent does not propagate, only wxCommandEvent derived events do, so your proposed change does nothing.
omlk:
--- Quote from: sodev on November 28, 2023, 10:08:17 pm ---I suggest next time you post something, you do more research about the topic, this is not the first time you post such nonsense.
A wxMouseEvent does not propagate, only wxCommandEvent derived events do, so your proposed change does nothing.
--- End quote ---
Explain why it doesn't make sense, it's not a simple solution and I'm not a newbie, so I'll gladly listen to how it should be right in this case.
Navigation
[0] Message Index
[#] Next page
Go to full version