Skip to content

Commit

Permalink
disable news page to prevent from liblo error due to fork
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Aug 22, 2024
1 parent fad5603 commit 514ae01
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
21 changes: 19 additions & 2 deletions gui/src/tascar_mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "tascar.res.c"
#include <fstream>

#undef WEBKIT2GTK30
#undef WEBKIT2GTK40

#define GET_WIDGET(x) \
m_refBuilder->get_widget(#x, x); \
if(!x) \
Expand Down Expand Up @@ -249,6 +252,8 @@ tascar_window_t::tascar_window_t(BaseObjectType* cobject,
bool load_news(TASCAR::config("tascar.gui.newspage", true));
if(load_news)
webkit_web_view_load_uri(news_view, url.c_str());
#else
notebook->remove_page(-1);
#endif
notebook->show_all();
auto css = Gtk::CssProvider::create();
Expand Down Expand Up @@ -513,6 +518,8 @@ void tascar_window_t::load(const std::string& fname)
{
get_warnings().clear();
numlastwarnings = 0;
while(Gtk::Main::events_pending())
Gtk::Main::iteration(false);
scene_load(fname);
tascar_filename = fname;
sessionquit = false;
Expand Down Expand Up @@ -723,7 +730,7 @@ void tascar_window_t::reset_gui()
Glib::filename_display_basename(tascar_filename) + "]");
} else {
set_title("tascar");
resize(200, 60);
//resize(200, 60);
}
update_object_list();
if(session && (session->scenes.size() > selected_scene)) {
Expand All @@ -750,8 +757,11 @@ void tascar_window_t::reset_gui()
TASCAR::env_expand(session->starturl).c_str());
notebook->set_current_page(6);
}
webkit_web_view_reload_bypass_cache(news_view);
if(session)
webkit_web_view_reload_bypass_cache(news_view);
#endif
while(Gtk::Main::events_pending())
Gtk::Main::iteration(false);
}

void tascar_window_t::on_menu_file_quit()
Expand All @@ -763,6 +773,7 @@ void tascar_window_t::on_menu_file_close()
{
try {
scene_destroy();
resize(200, 60);
// get_warnings().clear();
#if defined(WEBKIT2GTK30) || defined(WEBKIT2GTK40)
webkit_web_view_try_close(news_view);
Expand Down Expand Up @@ -1013,6 +1024,8 @@ void tascar_window_t::on_menu_file_reload()
scene_destroy();
reset_gui();
// wait?
while(Gtk::Main::events_pending())
Gtk::Main::iteration(false);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
scene_load(tascar_filename);
sessionquit = false;
Expand Down Expand Up @@ -1087,6 +1100,8 @@ void tascar_window_t::on_menu_file_open()
try {
get_warnings().clear();
numlastwarnings = 0;
while(Gtk::Main::events_pending())
Gtk::Main::iteration(false);
scene_load(filename);
tascar_filename = filename;
sessionquit = false;
Expand Down Expand Up @@ -1133,6 +1148,8 @@ void tascar_window_t::on_menu_file_open_example()
try {
get_warnings().clear();
numlastwarnings = 0;
while(Gtk::Main::events_pending())
Gtk::Main::iteration(false);
scene_load(filename);
tascar_filename = filename;
sessionquit = false;
Expand Down
29 changes: 22 additions & 7 deletions libtascar/src/osc_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ TASCAR::osc_server_t::data_element_t::data_element_t(const std::string& p,
void err_handler(int num, const char* msg, const char* where)
{
liblo_errflag = true;
std::cout << "liblo error " << num << ": " << msg << "\n(" << where << ")\n";
std::string smsg;
if(msg)
smsg = msg;
std::string swhere = "null";
if(where)
swhere = where;
std::cout << "liblo error " << num << ": " << smsg << "\n(" << swhere
<< ")\n";
}

int osc_set_bool_true(const char*, const char*, lo_arg**, int, lo_message,
Expand Down Expand Up @@ -603,9 +610,10 @@ osc_server_t::osc_server_t(const std::string& multicast,
port.c_str(), string2proto(proto), err_handler);
initialized = true;
}
if((!lost) || liblo_errflag)
if((!lost) || liblo_errflag) {
throw ErrMsg("liblo error (srv_addr: \"" + multicast + "\" srv_port: \"" +
port + "\" " + proto + ").");
}
}
if(lost) {
char* ctmp(lo_server_thread_get_url(lost));
Expand Down Expand Up @@ -655,10 +663,12 @@ osc_server_t::~osc_server_t()
cond_var_script.notify_one();
if(scriptthread.joinable())
scriptthread.join();
if(isactive)
if(isactive) {
deactivate();
if(initialized)
}
if(initialized) {
lo_server_thread_free(lost);
}
}

void osc_server_t::set_prefix(const std::string& prefix_)
Expand Down Expand Up @@ -883,8 +893,11 @@ void osc_server_t::add_string(const std::string& path, std::string* data,
void osc_server_t::activate()
{
if(initialized) {
lo_server_thread_start(lost);
isactive = true;
int result = lo_server_thread_start(lost);
if(result < 0)
std::cerr << "lo_server_thread_start failed\n";
else
isactive = true;
if(verbose)
std::cerr << "server active\n";
}
Expand All @@ -894,7 +907,9 @@ void osc_server_t::deactivate()
{
if(initialized) {
isactive = false;
lo_server_thread_stop(lost);
int result = lo_server_thread_stop(lost);
if(result < 0)
std::cerr << "lo_server_thread_stop failed\n";
if(verbose)
std::cerr << "server inactive\n";
}
Expand Down

0 comments on commit 514ae01

Please sign in to comment.