Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

click Exit segmentation fault 点击exit出现段错误 #2

Open
itas109 opened this issue Sep 12, 2020 · 2 comments
Open

click Exit segmentation fault 点击exit出现段错误 #2

itas109 opened this issue Sep 12, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@itas109
Copy link
Owner

itas109 commented Sep 12, 2020

Describe the bug
click Exit segmentation fault
点击exit出现段错误

To Reproduce
Steps to reproduce the behavior:
click Exit button

Screenshots

$ ./commlite 
段错误 (核心已转储)

Desktop (please complete the following information):

  • OS: ubuntu 20.04
  • Compiler: gcc 9.3.0
  • Version: 1.0.0
@itas109 itas109 added the bug Something isn't working label Sep 12, 2020
@itas109
Copy link
Owner Author

itas109 commented Sep 12, 2020

maybe sigslot's problem

@itas109
Copy link
Owner Author

itas109 commented Dec 13, 2020

class mySlot : public has_slots<>
{
public:
	mySlot(CSerialPort * sp)
    {
	    recLen = -1;
        p_sp = sp; 
    };

	void OnSendMessage()
	{
		//read
		recLen = p_sp->readAllData(str);

        if(recLen > 0)
        {
            if(!isShowHex)
            {
                str[recLen] = '\0';
                bodymsg(str);
            }
            else
            {
                for (int i = 0; i < recLen; i++)
                {
                    snprintf(hexChar,sizeof(hexChar), "%02X ", str[i] & 0xFF);// two bit hex +  one bit space + '\0'
                    hexChar[sizeof(hexChar)-1] = '\0';
                    bodymsg(hexChar);
                }
            }
        }
	};

private:
	mySlot(){};

private:
	CSerialPort * p_sp;

    int recLen;
    char hexChar[4];// two bit hex +  one bit space + '\0'
	char str[1024];
};
CSerialPort m_serialPort;
mySlot receive(&m_serialPort);

itas109 added a commit that referenced this issue Dec 13, 2020
Signed-off-by: itas109 <itas109@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant