Giter Club home page Giter Club logo

Comments (23)

DamirPorobic avatar DamirPorobic commented on May 30, 2024 1

No worries regarding the 1.1.0, it's just a variable that I forgot to change when I released the version, I've noticed it myself few minutes ago and changed it. See commit 8ce4b01

You can download from master and the install procedure again and it will be 1.2.0.

Regarding your crash, does it start only with gdb or also without gdb now?

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024 1

hmm, let's try something. Open up src/widgets/PaintArea.cpp, go to line 310 and comment following out (just add // in front of the line):

void PaintArea::setCursor()
{
    // delete mCursor;       <-- Like here
    mCursor = cursor();

    for ( int i = 0; i < views().length(); i++ ) {
        views().at( i )->setCursor( *mCursor );
    }
}

Save, delete all from build directory and run cmake and make again. Try to run ./ksnip again, see what happens.

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024 1

Great! Thanks to you for developing such a great tool!

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

What distro are you using?

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

Slackware-current, 64-bit series.
gcc 5.4.0

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

ksnip_strace.txt

Attaching strace output (both stdin & stderr) of ksnip 1.2.0 invocation.

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

I've just installed slackware 14.2 64bit in a virtual machine and ksnip was installed and started right away, without installing or changing anything else. So it seems for now not related to slackware rather something related to your system.

http://i.imgur.com/svYoS5Y.png

Can you try to run the ksnip in gdb, maybe we can see something there.
go back to the build directory and now run cmake but instead of cmake .. use cmake -DCMAKE_BUILD_TYPE=Debug ..

Then continue with make and gdb ./knsip
You should see the gdb prompt, type run and watch the output. If you get the prompt again without crash type next and hit enter, keep doing that until the crash happens or ksnip starts. Send me the output that you collect from there.

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

I've just installed slackware 14.2 64bit in a virtual machine

Please be advised that Slackware 14.2 and Slackware-current differ significantly as of now (the latter has more up-to-date libraries and toolchain, etc.)
Will do what you suggest. Thanks!

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

it's funny. I did what you said and now it runs correctly. Output:

(gdb) run
Starting program: /run/media/eduardo/Seagate Backup Plus Drive/build/slackbuilds/ksnip/ksnip-1.2.0/build/ksnip 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

ksnip run correctly. However it still identifies itself as 1.1.0.

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

I found the issue!

I usually build ksnip as a Slackware package and for that we use bash scripts we call "SlackBuilds".

This particular SlackBuild was adapted from other software. There was a line where, if the CPU architecture was x86_64, it gave gcc as compiler flags the following; -O2 -fPIC.

Since there wasn't any such flags when compiling ksnip "by hand", I tried building with the -fPIC flag deleted. And it built without problem!

Ksnip now works correctly with the SlackBuild after deleting -fPIC from the compiler flags

The fact, however, remains: the -fPIC flag produced correct builds in 1.1.0 while in 1.2.0 gave segfaulting binaries.

For now, I deleted the -fPIC flag from my SlackBuild and Ksnip run correctly again. Thanks!!

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

Updated bug title to better reflect the crash case.

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

It really is strange, but I'm glad that you found the issue.
I'll check later regarding the -fPIC flag.

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

I just built a SlackBuild with -fPIC enabled and with the debug flag. I then ran gdb on the ksnip executable (which promptly segfaulted). This is the relevant gdb output:

(gdb) run
Starting program: /bin/ksnip 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6df0000 in QCursor::~QCursor() () from /usr/lib64/libQtGui.so.4
(gdb) 

Thanks!

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

I'm not familiar with the -fPIC flag but it looks like it should be used with shared libraries to make them more independent of where they're executed. So not sure if you should be using this flag in first place.

I'm also unable to reproduce the issue on my end. I have added set(CMAKE_POSITION_INDEPENDENT_CODE ON) to the CMakeLists.txt this is the equivalent of -fPIC, it compiles and runs without crash.

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

Same on Slackware, no crash with PIC. Though I haven't tested it on -current which is a pre-release version for testing purposes.

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

One more think we could check. Run gdb again, but when it crashes, run from the gdb prompt bt
Maybe the backtrace will show something.

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

ok. First I forgot to give "next" when gdb showed a segfault. This is the full output:

(gdb) run
Starting program: /bin/ksnip 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6df0000 in QCursor::~QCursor() () from /usr/lib64/libQtGui.so.4
(gdb) next
Single stepping until exit from function _ZN7QCursorD2Ev,
which has no line number information.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) 

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

Backtrace:

(gdb) run
Starting program: /bin/ksnip 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6df0000 in QCursor::~QCursor() () from /usr/lib64/libQtGui.so.4
(gdb) bt
#0  0x00007ffff6df0000 in QCursor::~QCursor() () at /usr/lib64/libQtGui.so.4
#1  0x000000000042a980 in PaintArea::setCursor() ()
#2  0x000000000042c10a in MainWindow::loadSettings() ()
#3  0x000000000042e966 in MainWindow::MainWindow() ()
#4  0x000000000041a15c in main ()
(gdb) 

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

After commenting out line 310 in PaintArea.cpp, Ksnip builds and run correctly even with the -fPIC flag enabled.
Thanks!!

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

Interesting, so we know where the issue happens though I can't leave it like that, that would cause a memory leak.
I'll think about some solution then I will ask you again to test when I have a patch.

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

Can you please download the latest version and try to build and run it?

https://github.com/DamirPorobic/ksnip/tree/v1.2.1

from ksnip.

thegreyshadow avatar thegreyshadow commented on May 30, 2024

I can confirm that 1.2.1 now builds and run correctly in x86_64 even with -O2 -fPIC enabled. Great!!

from ksnip.

DamirPorobic avatar DamirPorobic commented on May 30, 2024

Awesome! Thanks for testing and confirming. :)

from ksnip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.