Fix init of VisualServerRaster

Contrarily to what #23434 assumed, this is not a memory leak,
the VisualServerRaster instance is passed as a parameter to
VisualServerWrapMT's constructor.

Fixes #23437.
This commit is contained in:
Rémi Verschelde 2018-11-01 19:22:15 +01:00
parent b9dd095275
commit 8ac1bcfd3d
7 changed files with 11 additions and 38 deletions

View file

@ -182,15 +182,12 @@ Error OS_Android::initialize(const VideoMode &p_desired, int p_video_driver, int
video_driver_index = p_video_driver;
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();
// visual_server->cursor_set_visible(false, 0);
AudioDriverManager::initialize(p_audio_driver);

View file

@ -117,12 +117,10 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p
#endif
// FIXME: Reimplement threaded rendering? Or remove?
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE);

View file

@ -107,11 +107,10 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
// FIXME: Reimplement threaded rendering? Or remove?
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();

View file

@ -1383,11 +1383,9 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
video_driver_index = p_video_driver;
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();

View file

@ -294,12 +294,10 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
set_video_mode(vm);
// FIXME: Reimplement threaded rendering? Or remove?
visual_server = memnew(VisualServerRaster);
// FIXME: Reimplement threaded rendering
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, false));
} else {
visual_server = memnew(VisualServerRaster);
}
visual_server->init();

View file

@ -1332,27 +1332,11 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
gl_context->set_use_vsync(video_mode.use_vsync);
#endif
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
/*
DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared
dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
*/
visual_server->init();
input = memnew(InputDefault);

View file

@ -343,12 +343,11 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
#endif
visual_server = memnew(VisualServerRaster);
if (get_render_thread_mode() != RENDER_THREAD_UNSAFE) {
visual_server = memnew(VisualServerWrapMT(visual_server, get_render_thread_mode() == RENDER_SEPARATE_THREAD));
} else {
visual_server = memnew(VisualServerRaster);
}
if (current_videomode.maximized) {
current_videomode.maximized = false;
set_window_maximized(true);