ApoorvaJ / Papaya

A GPU-powered image editor (in the making)
MIT License
373 stars 33 forks source link

Crash when clicking on icon with loaded image #4

Closed nem0 closed 8 years ago

nem0 commented 8 years ago

Steps to reproduce:

  1. Load an image (I tried both jpeg and png, no difference)
  2. click on the icon in the top left corner
  3. observe crash

Note: it crashes in nvidia driver, so I guess it's some invalid opengl call Note: HEAP[Papaya.exe]: Heap block at 048A47C8 modified at 048A4863 past requested size of 93, I printed all the allocations from Papaya, there are some close allocations Note: It does not crash if there is no image or there had been an image and it has been closed. Note: If I disable

WindowFlags |= ImGuiWindowFlags_NoTitleBar;
WindowFlags |= ImGuiWindowFlags_NoResize;

for the icon, it does not crash

ApoorvaJ commented 8 years ago

Thanks for the detailed report.

I was able to reproduce the issue. In a quick test, the crash doesn't occur if I change the icon drawing line of code from

 ImGui::Image((void*)(intptr_t)Mem.Textures[PapayaTex_TitleBarIcon], ImVec2(28,28));

to

 ImGui::ImageButton((void*)(intptr_t)Mem.Textures[PapayaTex_TitleBarIcon], ImVec2(28,28));

This makes me think that it might be an issue with ImGui, or I that might be using ImGui::Image() incorrectly. I am looking into it, and will get back to you as soon as I find anything.

ApoorvaJ commented 8 years ago

The crash was a side-effect of me using an incorrect vertex buffer. The issue only manifested itself when a very specific set of conditions were true. Hence the strange behavior.

I have stopped the crash for now, and left a TODO note for myself to improve that part of the code even further.

nem0 commented 8 years ago

Cool, it doesn ot crash anymore.

btw

const int32 FileNameSize = 400; // TODO: What's a good value for this?

MAX_PATH is the answer :)

ApoorvaJ commented 8 years ago

Fixed. That was an interesting read. Thanks again. :)