yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.14k stars 184 forks source link

profiler_gui crash #210

Open KROIA opened 9 months ago

KROIA commented 9 months ago

Hi yse

First of all I want to thank you very much for your cool profiler library. I use it in nearly every project now.

Recently I had a crash while using the profiler_gui. Crash occured in function in const ::profiler_gui::EasyBlock* GraphicsBlockItem::intersect(const QPointF& _pos, ::profiler::block_index_t& _blockIndex) const

To reproduce: load my "profiler.prof" file which is contained in the zip file. after that i had to move my view in the middle like you see in the image: "easy_profiler_guiCrash.PNG" in the background. from there I scrolled in and out multiple times and waited until the event which calls the function gets fired and eventualy it crashed after 10 try's or so.

In the Image "easy_profiler_guiCrash_vars.PNG" you can se the section in which the debuger stops because of the crash. I don't understand your code but I tryed a change which you can see on the line: 1276. With that change the application did not crash any more.

I never had this problem before and I don't know if there is an issue with the .prof file which causes that problem. It may be a error on my side because I can also see, that some of my generated blocks are missing in the view. Maybe I did something wrong in the application I'm profiling.

CrashFiles.zip

Thank you for your work

yse commented 9 months ago

Hello! Thank you for the valuable feedback 🙏

I've been fixed the bug by adding safety advancing of the iterator and ensure range for this

You are welcome to ask any questions and create issues for the project.

By the way I've fixed old bug with infinite loop - see #186