Browse Source

Linux: Fixed some crashes when getting X properties in LinuxComponentPeer

tags/2021-05-28
ed 6 years ago
parent
commit
1ea463f989
1 changed files with 14 additions and 8 deletions
  1. +14
    -8
      modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp

+ 14
- 8
modules/juce_gui_basics/native/juce_linux_X11_Windowing.cpp View File

@@ -1299,14 +1299,16 @@ public:
ScopedXLock xlock (display);
GetXProperty prop (display, windowH, atoms->state, 0, 64, false, atoms->state);
unsigned long state;
memcpy (&state, prop.data, sizeof (unsigned long));
if (prop.success && prop.actualType == atoms->state
&& prop.actualFormat == 32 && prop.numItems > 0)
{
unsigned long state;
memcpy (&state, prop.data, sizeof (unsigned long));
return state == IconicState;
}
return prop.success
&& prop.actualType == atoms->state
&& prop.actualFormat == 32
&& prop.numItems > 0
&& state == IconicState;
return false;
}
void setFullScreen (bool shouldBeFullScreen) override
@@ -2757,10 +2759,14 @@ private:
long getUserTime() const
{
GetXProperty prop (display, windowH, atoms->userTime, 0, 65536, false, XA_CARDINAL);
if (! prop.success)
return 0;
long result;
memcpy (&result, prop.data, sizeof (long));
return prop.success ? result : 0;
return result;
}
void updateBorderSize()


Loading…
Cancel
Save