Crash in juce_win32_windowing.cpp


my juce application crashes, whenever i have 2 juce application running together.
my juce applications are developed using juce_1_53 version of juce.
i have launched my application_1 and it has a scrollbar, now i simultaneously launch juce_helloworld app , now i give focus to juce_helloworld app and do mouse wheel move on my application_1 , juce_helloworld app crashes…
similarly if i give focus to my application_1 and do mouse wheel move on juce_helloworld app my application_1 crashes at the below shown code.

const float amount = jlimit (-1000.0f, 1000.0f, 0.75f * (short) HIWORD (wParam));

// Because win32 stupidly sends all wheel events to the window with the keyboard
// focus, we have to redirect them here according to the mouse pos…
POINT p = { globalPos.getX(), globalPos.getY() };
Win32ComponentPeer* peer = getOwnerOfWindow (WindowFromPoint §);

if (peer == nullptr)
peer = this;

—>place of crash-----> peer->handleMouseWheel (0, peer->globalToLocal (globalPos), getMouseEventTime(),
isVertical ? 0.0f : -amount,
isVertical ? amount : 0.0f);

can somebody help me on this. where am i going wrong. :frowning: i am not able to solve this issue for quite sometime now.


Hmm. Interesting. I think I know what this may be, and will add some code to the modules branch today which should help, but it’d be up to you to translate that back to the old 1.53 version if you don’t want to update.


Thanks Jules, for replying.

i tried with previous version of juce i.e. juce_1_51, the code there is entirely different.


const float amount = jlimit (-1000.0f, 1000.0f, 0.75f * (short) HIWORD (wParam));

handleMouseWheel (0, position, getMouseEventTime(),
isVertical ? 0.0f : amount,
isVertical ? amount : 0.0f);

but i don’t want to mess around with juce code myself.

And I am ready to translate whatever changes you make.


I believe you may want to make some changes in getOwnerWindow() method… and if you could explain the cause of bug… i would be grateful to you…


It tags windows with an integer to recognise them as being juce windows, but I don’t think that number was unique to each app, so it may be incorrectly trying to pull a pointer out of a foreign window.

I’ve committed a fix now, so have a look at the diff, but I think the classes may be different to the way it was done in the old version.


godly jules!!!
Thanks a lot!!! i even got your explanation…
I made the changes you committed, to the version of juce i have. And it worked… No crash… Now i can happily run all my juce applications together :wink:

Thanks a lot. :slight_smile: