Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cryptic malloc crash
Forum Updated to NodeBB v4.3 + New Features

Cryptic malloc crash

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 50 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jackmill
    wrote last edited by
    #1

    I have a basic QAction set up as a sort of test action:

    actions_.network_ping_ = new QAction(tr("Ping"), this);
    	connect(actions_.network_ping_, &QAction::triggered,
    		this, [this] {
    			osc_service_->send(EosOscMessage::ping());
    		});
    

    Whenever I trigger this action, it works as expected, and does exactly as prescribed, but then my program crashes with an error that I don't know what to do with:

    PaletteRepo(74405,0x16d1ab000) malloc: Corruption of free object 0x14402bb90: msizes 25903/0 disagree
    PaletteRepo(74405,0x16d1ab000) malloc: *** set a breakpoint in malloc_error_break to debug
    

    This still happens if I rewrite that lambda in the connect call into a slot.

    If I set a breakpoint and step through, it takes me to qobjectdefs_impl.h, specifically line 116:

    template <typename, typename, typename, typename> struct FunctorCall;
        template <size_t... II, typename... SignalArgs, typename R, typename Function>
    struct FunctorCall<std::index_sequence<II...>, List<SignalArgs...>, R, Function> : FunctorCallBase
        {
            static void call(Function &f, void **arg)
            {
                call_internal<R>(arg, [&] {
                    return f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...); // < This line
                });
            }
        };
    

    I'm not super familiar with malloc so I don't know what malloc_error_break is or how to set a breakpoint there as the error suggests.

    Does anybody have any guidance here?

    This is in CLion on macOS Sequoia.

    Pl45m4P JonBJ 2 Replies Last reply
    0
    • J Jackmill

      I have a basic QAction set up as a sort of test action:

      actions_.network_ping_ = new QAction(tr("Ping"), this);
      	connect(actions_.network_ping_, &QAction::triggered,
      		this, [this] {
      			osc_service_->send(EosOscMessage::ping());
      		});
      

      Whenever I trigger this action, it works as expected, and does exactly as prescribed, but then my program crashes with an error that I don't know what to do with:

      PaletteRepo(74405,0x16d1ab000) malloc: Corruption of free object 0x14402bb90: msizes 25903/0 disagree
      PaletteRepo(74405,0x16d1ab000) malloc: *** set a breakpoint in malloc_error_break to debug
      

      This still happens if I rewrite that lambda in the connect call into a slot.

      If I set a breakpoint and step through, it takes me to qobjectdefs_impl.h, specifically line 116:

      template <typename, typename, typename, typename> struct FunctorCall;
          template <size_t... II, typename... SignalArgs, typename R, typename Function>
      struct FunctorCall<std::index_sequence<II...>, List<SignalArgs...>, R, Function> : FunctorCallBase
          {
              static void call(Function &f, void **arg)
              {
                  call_internal<R>(arg, [&] {
                      return f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...); // < This line
                  });
              }
          };
      

      I'm not super familiar with malloc so I don't know what malloc_error_break is or how to set a breakpoint there as the error suggests.

      Does anybody have any guidance here?

      This is in CLion on macOS Sequoia.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote last edited by
      #2

      @Jackmill

      What type is actions_.network_ping?
      And does it also crash when you remove the 3rd Party function from your lambda/slot?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1
      • J Jackmill

        I have a basic QAction set up as a sort of test action:

        actions_.network_ping_ = new QAction(tr("Ping"), this);
        	connect(actions_.network_ping_, &QAction::triggered,
        		this, [this] {
        			osc_service_->send(EosOscMessage::ping());
        		});
        

        Whenever I trigger this action, it works as expected, and does exactly as prescribed, but then my program crashes with an error that I don't know what to do with:

        PaletteRepo(74405,0x16d1ab000) malloc: Corruption of free object 0x14402bb90: msizes 25903/0 disagree
        PaletteRepo(74405,0x16d1ab000) malloc: *** set a breakpoint in malloc_error_break to debug
        

        This still happens if I rewrite that lambda in the connect call into a slot.

        If I set a breakpoint and step through, it takes me to qobjectdefs_impl.h, specifically line 116:

        template <typename, typename, typename, typename> struct FunctorCall;
            template <size_t... II, typename... SignalArgs, typename R, typename Function>
        struct FunctorCall<std::index_sequence<II...>, List<SignalArgs...>, R, Function> : FunctorCallBase
            {
                static void call(Function &f, void **arg)
                {
                    call_internal<R>(arg, [&] {
                        return f((*reinterpret_cast<typename RemoveRef<SignalArgs>::Type *>(arg[II+1]))...); // < This line
                    });
                }
            };
        

        I'm not super familiar with malloc so I don't know what malloc_error_break is or how to set a breakpoint there as the error suggests.

        Does anybody have any guidance here?

        This is in CLion on macOS Sequoia.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote last edited by
        #3

        @Jackmill
        As @Pl45m4 has written.
        Do you mean it crashes after the connect() call, or do you mean it crashes after the first time the signal is actually emitted and the slot/lambda is called?
        Make the body of the slot/lambda just do a qDebug() << "Hello world"; and not call anything else.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved