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

Windows crash on sys.get_output #1142

Open
CrystalMoogle opened this issue May 6, 2014 · 4 comments
Open

Windows crash on sys.get_output #1142

CrystalMoogle opened this issue May 6, 2014 · 4 comments

Comments

@CrystalMoogle
Copy link
Member

More specifically, getProcessId causes a crash

 inline quint64 getProcessID(const QProcess* proc)
    {
        #ifdef Q_OS_WIN
            struct _PROCESS_INFORMATION* procinfo = proc->pid();
            return procinfo->dwProcessId;
        #else // Linux
            return proc->pid();
        #endif // Q_WS_WIN
    }

Debug marks the crash point being return procinfo->dwProcessId

@HRDepartment
Copy link
Contributor

The types are somewhat wrong, this should be correct

inline qint64 getProcessID(const QProcess* proc)
    {
        #ifdef Q_OS_WIN
            Q_PID procinfo = proc->pid();
            return qint64(procinfo->dwProcessId);
        #else // Linux
            return proc->pid();
        #endif // Q_OS_WIN
    }

If that doesn't fix it it has to be something else.

@coyotte508
Copy link
Member

I don't think that's the issue.

But that's an improvement, also a null check should definitely be done

@HRDepartment
Copy link
Contributor

It's a timing issue I'm pretty sure, applications don't have time to start up, the pid will be null. One solution is to make a blocking call to wait until the application has started (there is a function for this), another would be to change how the function behaves.

@HRDepartment
Copy link
Contributor

Another reason why could be because the application could never start up, because it for example doesn't exist. Netcat, for instance, is not a core Windows command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants