Skip to content

Commit d65295f

Browse files
committed
.
2 parents 938fc8b + 888309b commit d65295f

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

CImg.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
// Set version number of the library.
5656
#ifndef cimg_version
57-
#define cimg_version 401
57+
#define cimg_version 402
5858

5959
/*-----------------------------------------------------------
6060
#
@@ -8076,6 +8076,7 @@ namespace cimg_library {
80768076

80778077
// Destroy previous display window if existing.
80788078
if (!is_empty()) assign(false);
8079+
if (!dimw || !dimh) return;
80798080

80808081
// Open X11 display and retrieve graphical properties.
80818082
cimg::X11_attr &X11_attr = cimg::X11_attr::ref();
@@ -9440,6 +9441,7 @@ namespace cimg_library {
94409441

94419442
// Destroy previous window if existing.
94429443
if (!is_empty()) assign();
9444+
if (!dimw || !dimh) return;
94439445

94449446
// Set display variables.
94459447
_width = std::min(dimw,(unsigned int)screen_width());
@@ -10138,27 +10140,17 @@ namespace cimg_library {
1013810140
const unsigned int normalization_type=3,
1013910141
const bool is_fullscreen=false, const bool closed_flag=false) {
1014010142

10141-
// Destroy previous display window if existing.
10142-
if (!is_empty()) assign();
10143-
_data = new unsigned int[_width*_height];
10144-
10145-
cimg::SDL3_attr &SDL3_attr = cimg::SDL3_attr::ref();
10146-
SDL3_attr.lock();
10147-
10148-
if (SDL3_attr.nb_cimg_displays>=512) {
10149-
SDL3_attr.unlock();
10150-
throw CImgDisplayException("CImgDisplay::assign(): Max number of displays (512) already opened.");
10151-
}
10152-
1015310143
// Allocate space for window title.
1015410144
const char *const np_title = p_title?p_title:"";
1015510145
const unsigned int s = (unsigned int)std::strlen(np_title) + 1;
1015610146
char *const tmp_title = s?new char[s]:0;
1015710147
if (s) std::memcpy(tmp_title,np_title,s*sizeof(char));
1015810148

10149+
// Destroy previous display window if existing.
10150+
if (!is_empty()) assign();
10151+
if (!dimw || !dimh) return;
10152+
1015910153
// Set display variables.
10160-
_width = std::min(dimw,(unsigned int)screen_width());
10161-
_height = std::min(dimh,(unsigned int)screen_height());
1016210154
_normalization = normalization_type<4?normalization_type:3;
1016310155
_is_fullscreen = is_fullscreen;
1016410156
_window_x = _window_y = cimg::type<int>::min();
@@ -10167,6 +10159,16 @@ namespace cimg_library {
1016710159
_paint_request = false;
1016810160
_title = tmp_title;
1016910161
_thread_id = SDL_GetCurrentThreadID();
10162+
_width = std::min(dimw,(unsigned int)screen_width());
10163+
_height = std::min(dimh,(unsigned int)screen_height());
10164+
_data = new unsigned int[_width*_height];
10165+
10166+
cimg::SDL3_attr &SDL3_attr = cimg::SDL3_attr::ref();
10167+
SDL3_attr.lock();
10168+
if (SDL3_attr.nb_cimg_displays>=512) {
10169+
SDL3_attr.unlock();
10170+
throw CImgDisplayException("CImgDisplay::assign(): Max number of displays (512) already opened.");
10171+
}
1017010172
flush();
1017110173

1017210174
// Create window and renderer.

html/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="header">
1717
<a href="index.html"><img alt="Logo" src="img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
1818
<h2 style="padding-bottom: 1em">
19-
Latest stable version: <b><a href="http://cimg.eu/files/CImg_4.0.0.zip">4.0.0</a></b> (2026/07/01)
19+
Latest stable version: <b><a href="http://cimg.eu/files/CImg_4.0.1.zip">4.0.1</a></b> (2026/07/02)
2020
</h2>
2121

2222
<hr/>

html/header_doxygen.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="header">
2727
<a href="../index.html"><img alt="Logo" src="../img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
2828
<h2 style="padding-bottom: 1em">
29-
Latest stable version: <b><a href="http://cimg.eu/files/CImg_4.0.0.zip">4.0.0</a></b> (2026/07/01)
29+
Latest stable version: <b><a href="http://cimg.eu/files/CImg_4.0.1.zip">4.0.1</a></b> (2026/07/02)
3030
</h2>
3131

3232
<hr/>

0 commit comments

Comments
 (0)