Code::Blocks Forums

User forums => Help => Topic started by: rartigas on November 27, 2023, 10:40:06 pm

Title: wxsmith crashes while dragging
Post by: rartigas on November 27, 2023, 10:40:06 pm
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&amp;)" offset="0" address="0x110e8c1f5"/>
    <frame level="4" function="wxEventHashTable::HandleEvent(wxEvent&amp;, wxEvtHandler*)" offset="0" address="0x1033d17af"/>
    <frame level="5" function="wxEvtHandler::ProcessEventLocally(wxEvent&amp;)" offset="0" address="0x1033d24ca"/>
    <frame level="6" function="wxEvtHandler::ProcessEvent(wxEvent&amp;)" offset="0" address="0x1033d23c0"/>
    <frame level="7" function="wxScrollHelperEvtHandler::ProcessEvent(wxEvent&amp;)" offset="0" address="0x104b37c52"/>
    <frame level="8" function="wxEvtHandler::SafelyProcessEvent(wxEvent&amp;)" 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&amp;, 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
Title: Re: wxsmith crashes while dragging
Post by: 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;

    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;
}
EDIT: Cannot reproduce on MSW, may be MacOS-specific.
Title: Re: wxsmith crashes while dragging
Post by: omlk on November 28, 2023, 09:45:12 pm
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;
}
EDIT: Cannot reproduce on MSW, may be MacOS-specific.
Maybe the usage int StopPropagation () (https://docs.wxwidgets.org/3.0/classwx_event.html#a060a7d222404daff4d3cef30cddeaae3) 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;
Title: Re: wxsmith crashes while dragging
Post by: 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.
Title: Re: wxsmith crashes while dragging
Post by: omlk on November 28, 2023, 10:30:11 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.
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.
Title: Re: wxsmith crashes while dragging
Post by: Wkerry on November 29, 2023, 09:31:13 am
I wonder if  "o m l k" is now an AI bot as responses and posts are strange and do not make allot of sense for the last few weeks.
Title: Re: wxsmith crashes while dragging
Post by: rartigas on November 29, 2023, 09:56:01 am
Hi,

Is there any idea how this problem I posted can be solved?

I have been using CodeBlocks in Linux Ubuntu for many years, and mostly Qt Creator in the mac enviroment. On Windows I use Visual Studio + Qt Designer for professional use. The other two (linux and Mac) are mostly personal developments. The point is that Qt is being very aggressive with their politics about development environments used for personal purposes or professional purposes if you are the same person. This is the reason I'm adopting CodeBlocks on Mac. But, if problems like the one posted here are not solved, CB could not be a good option to develop under Mac.

I'm not expert in building CB from source. Even I tried and stoped with Hunspell library not installed, which is not true. So I'm more relying on people like you that can provide a binary file already compiled of CB

Thanks
Roger
Title: Re: wxsmith crashes while dragging
Post by: Miguel Gimenez on November 29, 2023, 12:41:24 pm
@wkerry, the posts have little sense from the very beginning. He debuted with a week ban because he refused to change his avatar from something like 640x640 to a reasonable size, finally the moderator had to reduce it.

@rartigas, we have no developers on Mac and the issue does not happen on MSW or on Linux, so it is difficult to fix. I posted the relevant code just in case somebody smarter than me spots something.

If Xaviou can test this issue with the debug version it would be very helpful.
Title: Re: wxsmith crashes while dragging
Post by: omlk on November 29, 2023, 05:21:03 pm
@Miguel Gimenez (https://forums.codeblocks.org/index.php?action=profile;u=34306)

Oh, you mentioned such a historical event, in which it was clear that the site was not convenient, but since you touched on this topic, I have the following question:Why is the editor for creating posts so backward and not convenient for users (people), everything in the text shifts somewhere, the "\n\r"("<br />") to a new row is deleted - it's just terrible? and still no one managed to make a highlight for the syntax of c, c++, shell, etc.?
And please explain the word "maybe" in English. speech - ignored? whether it depends on the person reading the word "maybe".And this is the section on the "Help" forum where people communicate, and if I made a mistake in something, please correct me, and don't forbid me from communicating here. If no one will communicate, then why this forum?
Title: Re: wxsmith crashes while dragging
Post by: Wkerry on November 30, 2023, 09:45:07 am
@Miguel Gimenez

I smell a BOT as the post makes absolute no sense and does not have any resemblance to how a real human would respond (no argument in that "I AM NOT A n AI....."  etc etc).

Maybe another ban for a bot?
Title: Re: wxsmith crashes while dragging
Post by: stahta01 on November 30, 2023, 04:31:45 pm
@Miguel Gimenez

I smell a BOT as the post makes absolute no sense and does not have any resemblance to how a real human would respond (no argument in that "I AM NOT A n AI....."  etc etc).

Maybe another ban for a bot?

I am thinking not a BOT, Troll, or Help Vampire. But, closest to Help Vampire of those three.

Tim S.
Title: Re: wxsmith crashes while dragging
Post by: Wkerry on December 01, 2023, 08:08:51 am
Thanks. I had to lookup what a Help Vampire is as I have never heard of it before and agree "it" does look like one.