mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-15 12:20:01 +01:00
BugFix glfw set Window Title
Function is not thread safe, causing crash when saving.
This commit is contained in:
@@ -54,7 +54,7 @@ static void saveSession(const std::string& filename, Session *session)
|
||||
// set session filename
|
||||
session->setFilename(filename);
|
||||
// cosmetics saved ok
|
||||
Rendering::manager().mainWindow().setTitle(filename);
|
||||
Rendering::manager().setMainWindowTitle(filename);
|
||||
Settings::application.recentSessions.push(filename);
|
||||
Log::Notify("Session %s saved.", filename.c_str());
|
||||
|
||||
@@ -67,7 +67,8 @@ static void saveSession(const std::string& filename, Session *session)
|
||||
session->unlock();
|
||||
}
|
||||
|
||||
Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullptr), dt_(0.f), dt__(0.f)
|
||||
Mixer::Mixer() : session_(nullptr), back_session_(nullptr), sessionSwapRequested_(false),
|
||||
current_view_(nullptr), dt_(0.f), dt__(0.f)
|
||||
{
|
||||
// unsused initial empty session
|
||||
session_ = new Session;
|
||||
@@ -141,8 +142,8 @@ void Mixer::update()
|
||||
// swap front and back sessions
|
||||
swap();
|
||||
++View::need_deep_update_;
|
||||
// set session filename
|
||||
Rendering::manager().mainWindow().setTitle(session_->filename());
|
||||
// inform new session filename
|
||||
Rendering::manager().setMainWindowTitle(session_->filename());
|
||||
Settings::application.recentSessions.push(session_->filename());
|
||||
}
|
||||
}
|
||||
|
||||
1
Mixer.h
1
Mixer.h
@@ -122,6 +122,7 @@ protected:
|
||||
Session *back_session_;
|
||||
std::list<Session *> garbage_;
|
||||
bool sessionSwapRequested_;
|
||||
bool sessionNameChanged_;
|
||||
void swap();
|
||||
|
||||
SourceList candidate_sources_;
|
||||
|
||||
@@ -278,8 +278,6 @@ void Rendering::pushBackDrawCallback(RenderingCallback function)
|
||||
|
||||
void Rendering::draw()
|
||||
{
|
||||
// guint64 _time = gst_util_get_timestamp ();
|
||||
|
||||
// operate on main window context
|
||||
main_.makeCurrent();
|
||||
|
||||
@@ -335,6 +333,11 @@ void Rendering::draw()
|
||||
g_timer_start(timer);
|
||||
}
|
||||
|
||||
// change main window title if requested
|
||||
if (!main_new_title_.empty()) {
|
||||
main_.setTitle(main_new_title_);
|
||||
main_new_title_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +490,7 @@ void RenderingWindow::setTitle(const std::string &title)
|
||||
{
|
||||
std::string fulltitle = Settings::application.windows[index_].name;
|
||||
if ( !title.empty() )
|
||||
fulltitle += " -- " + title;
|
||||
fulltitle = std::string(APP_NAME) + " -- " + title;
|
||||
|
||||
glfwSetWindowTitle(window_, fulltitle.c_str());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ class RenderingWindow
|
||||
|
||||
GLFWwindow *window_, *master_;
|
||||
RenderingAttrib window_attributes_;
|
||||
std::string title_changed_;
|
||||
int index_;
|
||||
float dpi_scale_;
|
||||
|
||||
@@ -106,9 +107,8 @@ public:
|
||||
|
||||
// Initialization OpenGL and GLFW window creation
|
||||
bool init();
|
||||
|
||||
// show windows and reset views
|
||||
void show();
|
||||
|
||||
// true if active rendering window
|
||||
bool isActive();
|
||||
// draw one frame
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
// get hold on the windows
|
||||
inline RenderingWindow& mainWindow() { return main_; }
|
||||
inline RenderingWindow& outputWindow() { return output_; }
|
||||
inline void setMainWindowTitle(const std::string t) { main_new_title_ = t; }
|
||||
|
||||
// request screenshot
|
||||
void requestScreenshot();
|
||||
@@ -160,6 +161,7 @@ private:
|
||||
std::list<RenderingCallback> draw_callbacks_;
|
||||
|
||||
RenderingWindow main_;
|
||||
std::string main_new_title_;
|
||||
RenderingWindow output_;
|
||||
|
||||
// file drop callback
|
||||
|
||||
Reference in New Issue
Block a user