Segfault when logger enabled

Issue #7 invalid
Damien Damien created an issue

Hi

I have a very strange behaviour when using QsLog. When the logger is disabled all is well, but once it is enabled I get a segfault on the line following the QsLog macro.

my code is here https://github.com/mistic100/UMWP-Autochanger/tree/master/src must be run with "--log" argument

here I get a segfault on line 56 of main.cpp
if I comment line 53 I get a segfault on line 282 on settings.cpp (the next QsLog call)

I'll try to make an SSCCE during the week, but if you have an idea :)

Comments (6)

  1. raz repo owner
    • changed status to open

    Hi, I am taking a look now at the issue. Just to confirm: it looks like you're using the latest version with threading not activated.

  2. raz repo owner

    I compiled a minimal version of your main.cpp with QsLog linked as a DLL but without including the project-specific and Windows files and it works for me, but I tried it on a different OS, and unfortunately I can't easily test on Windows this week.

    An idea: Do you really need to link QsLog as a DLL? Are you trying to use QsLog across different binaries? e.g same logger instance from a DLL and an exe. If not, try including QsLog.pri directly in your pro and remove references like:

    • DEFINES += QSLOG_IS_SHARED_LIBRARY_IMPORT
    • LIBS += -L$$PWD/QsLog/build-QsLogShared
    • LIBS += -lQsLog2
    • QsLog/QsLogSharedLibrary.pro

    from your pro files. Of course it should work even when linking it as DLL, but I'm trying to exclude dynamic linking as a reason.

  3. Damien Damien reporter

    Yes it's the last version.

    What is threading ? (your doc is very sparse)


    So I tried what you suggested : not using QsLog as a DLL, and it's works ! Thank you

  4. raz repo owner

    In case you have a large volume of logging, by using threading you can avoid that the UI freezes or lags. If your app runs fine without this option, you probably don't need it.

    I am glad to hear it works, I will try in the mean time to reproduce the errors with the DLL configuration.

  5. raz repo owner

    Can't seem to reproduce this on Linux, Mac or Windows. Please reopen if you think it's still relevant.

  6. Log in to comment