veigar icon indicating copy to clipboard operation
veigar copied to clipboard

析构问题

Open sxzxs opened this issue 6 months ago • 4 comments

#include "veigar/veigar.h"

int main(int argc, char** argv) {
    veigar::Veigar vg;
    if (vg.isInit()) {
        vg.uninit();
    }
    return 0;
}

问题: 1、如果主动调用uninit,下次执行会报消息队列打不开的错误 2、如果不调用uninit,析构函数assert会触发,并且如果注释析构代码,还是会触发异常 3、如果改成指针, 不delete,没问题

sxzxs avatar Jun 18 '25 10:06 sxzxs

上述示例没有执行init操作,示例是否不完整

winsoft666 avatar Jun 18 '25 13:06 winsoft666

@winsoft666 这个是主动调用uninit的例子,下次执行会报消息队列打不开的错误 如果注释掉uninit,会报assert错误

#include <iostream>

#include "logger.h"
#include "veigar.h"


#include <stdio.h>
#include <math.h>
#include <iostream>
#include <mutex>
#include <cstdlib>  //std::system
#include <inttypes.h>


//using namespace std;
//using namespace veigar;

veigar::Veigar vg;
int main(int argc, char** argv) {
    std::cout << "Test" << std::endl;
    bool isInitSucces = vg.init("test_vg", 200, 10240);
    if(isInitSucces)
    {
        std::cout << "init success.." << std::endl;
    }
    vg.setTimeoutOfRWLock(260);
    veigar::CallResult ret = vg.syncCall("test_a_vg", 30000, "start");
    if(ret.isSuccess())
    {
        std::cout << "call success" << std::endl;
        std::cout << "Call Result: " << ret.obj.get().as<bool>() << std::endl;
    }
    else
    {
        std::cout << "call fail." << std::endl;
    }

    if (vg.isInit()) {
        vg.uninit();
    }
    return 0;
}

sxzxs avatar Jun 19 '25 04:06 sxzxs

请问是哪个系统环境?

winsoft666 avatar Jun 22 '25 12:06 winsoft666

请问是哪个系统环境?

redhat7 调用进程不退出,被调用进程需要不断地退出重启

sxzxs avatar Jun 23 '25 08:06 sxzxs